Size Classes in iOS 7

Kurt Anderson picture Kurt Anderson · Nov 3, 2014 · Viewed 7.6k times · Source

I created a new app in Xcode 6 using Size Classes. After testing with iOS 7, I can't figure out how to get iPhone to display a certain size class while in landscape mode.

I first developed the UI with iPhone landscape as wAny hCompact, but iOS 7 doesn't recognize that. I had iPhone portrait in wAny hAny.

I then changed it so now I'm using wCompact hRegular for iPhone portrait. I then modified wAny hAny to be the landscape layout. But it's not using that layout when the iOS 7 device is in landscape.

Is iOS 7 able to use different size classes based on the device being portrait or landscape? If so, which size class should I be using?

Reference: Really helpful information about backwards compatibility with size classes.

ps. I'm not concerned with iPad because the device does not display a different size class based on the device rotation in iOS 8.

Answer

Andrei Konstantinov picture Andrei Konstantinov · Apr 15, 2015

Size classes works in iOS 7 for sure. But only if you follow several rules:

  • The app is built using Xcode version 6 or later
  • The deployment target of the app is earlier than iOS 8
  • Size classes are specified in a storyboard or xib file
  • The value of the height component is not compact (yep, this is your case, it's not possible in iOS 7, unfortunatelly)

There is a little explanation here: https://stackoverflow.com/a/24976792/2190175