you can add software dependent behavior
Objective-c
subview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Swift 3.x
subview.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Swift 2.x
subview.autoresizingMask = [.flexibleWidth, .flexibleHeight]
In Interface-Builder, go to tab 3 and click on the arrows in the middle, D
Another workaround is to implement the setFrame method and always adapt it to the size of the supervisor (not specified by frame.size). Remember to indicate the source you need.
- (void) setFrame:(CGRect)frame { CGRect rect = self.superview.frame; rect.origin.x = 0; rect.origin.y = 0; [super setFrame:rect]; }
Lepidopteron
source share