1

I'm building a UICollectionView where each cell has size of 159x159. When the app runs on ios8 it gives (whatever the simulator i choose : iPhone 4S, 5, 5S, 6, 6 Plus) :

on iPhone Simulator with iOS 8.3

But it has not the same size on iOS7 :

on iPhone Simulator with iOS 7.1

WTF ? Note that even my SearchBar has not the same width on both simulators.

QLag
  • 823
  • 1
  • 13
  • 33

1 Answers1

1

The reason for this is that iOS8 has layout margins whilst iOS7 does not. You have made your constraints of the views to the margins.

The way I would facilitate it is if you want it to look like the iOS8 version in both, then don't constrain the views to the margins, but to the edges themselves, and have a constant space between the views and the edges. If you are using storyboards for the auto layout, then you will notice you can tick either on or off if to constrain to margins or not.

margins constraint

Yarneo
  • 2,922
  • 22
  • 30
  • Oh God, i knew for this new margin constraints but i forgot... In fact, AutoLayout is enabled on this Storyboard, but i haven't created any constraints for now. Because it was well displayed on multiple simulators with iOS8, i thought i didn't need constraints.... – QLag May 31 '15 at 12:38
  • Yeah, it is a big change to the auto layouts. You would probably need constraints if you would want the iOS7 to have margins to its views. – Yarneo May 31 '15 at 12:45
  • Yep it's working great now :) (I had constraints between my UICollectionView and the view of my Viewcontroller). I unchecked the "Relative to margin" options like you said :) Fortunately, i don't need to add constraints in my UICollectionViewCells ... for now... That's not a Good practice, i know :D Thx – QLag May 31 '15 at 12:50
  • Perfect, Glad it helped! – Yarneo May 31 '15 at 12:52