I have a view which is correctly displayed on an iPhone 6 screen, but needs scrolling on an iPhone 5 screen. I am trying to change some Auto Layout constraint to remove the need to scroll on the latter.
Here is an attempt to explain my situation visually:
The first 2 screenshots are the existing situations on an iPhone 6 and iPhone 5. The third one is what I am trying to achieve (on iPhone 5 only).
I wrote the following Auto Layout contraints, but I am missing something here:
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=25,<=50)-[blueView]-(>=25,<=50)-[redView]-5-|"
options:0
metrics:nil
views:nameMap]];
Should Hugging and/or Compression Resistance be involved here? In what way?
Edit to show more of my actual code:
[self addSubview:loginNSignupScrollView]; [self.loginNSignupScrollView addSubview:logoImageView]; [self.loginNSignupScrollView addSubview:horizontalScrollView]; [self.loginNSignupScrollView addSubview:appVersionLabel]; [self.horizontalScrollView addSubview:loginView];[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[loginNSignupScrollView]|" options:0 metrics:nil views:nameMap]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[loginView(==350)]" options:0 metrics:nil views:nameMap]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=30,<=60)-[logoImageView(==35)]-(>=25,<=50)-[horizontalScrollView]-30-[appVersionLabel]-5-|" options:0 metrics:nil views:nameMap]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.horizontalScrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeHeight multiplier:0.0 constant:350]];