I made a special test application for this case. (I'm sorry it has already been deleted)
I added an idea of my controller view in Storyboard , set AutoLayout constraints in Interface Builder and made one of them (vertical space) for different difference classes. Screenshot from IB
So, the value is 100 for Any height, Any width and 0 for Regular height, Regular width . It works well, on the iPhone the vertical distance from the top is 100, when on the iPad it's 0.
I also made an IBOutlet for this restriction and want to change it at runtime to 10
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topVerticalConstraint;
it seemed I could not change it because it has no effect
- (void)viewDidLoad { [super viewDidLoad]; self.topVerticalConstraint.constant = 10;
Although it works when I delete the value for Regular height, Regular width in Interface Builder .
Am I missing something in size classes?
source share