Oren
Oren

Reputation: 85

Constraints are working on iOS 8, but not on iOS 7

I'm trying to show a UITableView when a user presses the navigation bar button. My table view is built on the interface builder and I give it these constraints:

  1. Trailing space to: superView.
  2. Top space to: top layout guide.
  3. Width.
  4. Height.

(The table view should be at the top right side of the viewController's view when the user press at the button).

Now, I don't know why, but it works perfectly on iOS 8, but on iOS 7 the table is losing some pixels from the right (it slides outside from the view). I've noticed it can happen on labels too. Can anyone help me understand why?

Upvotes: 0

Views: 299

Answers (1)

Aris
Aris

Reputation: 1559

In Xcode 6, the Layout Constraints are set against the Margin of the superview. That only works in ios 8 though. To get the old behavior, you need to select a constraint from IB, go to Attributes Inspector and see if the first or second item is set to margins.

For example:First Item: Superview.trailing Margin

Click on it and uncheck "Relative to margin". You will have to do that to all your constraints.

Upvotes: 3

Related Questions