0

In Xcode 7, I add the constraints to a label that attached to the left of the screen, as follows:

constraints of label

But, the label's positions are very different from iOS7 to iOS8, as follows:

label's positions in iOS7 & iOS8

So, the question is:How should I set the leading space that fits both iOS7 and iOS8?

Any solution/workaround?

kenmux
  • 151
  • 1
  • 10

2 Answers2

1

This is related to the Constrain to margins option.

More explanations available here : https://stackoverflow.com/a/28692783/3096087

Community
  • 1
  • 1
Niko
  • 3,412
  • 26
  • 35
1

The reason is that iOS 8 has layout margins and iOS 7 does not. You have made your constraints between the edge of the label and the margin of the superview — but in iOS 7 there are no margins. Thus, in order to be compatible with both, the runtime must do something. So it treats the margins as zero in iOS 7, which is what they are because they don't exist at all. Remove the check on "Constrain to margins"

LS_
  • 6,763
  • 9
  • 52
  • 88