7

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.

Community
  • 1
  • 1
Kurt Anderson
  • 932
  • 1
  • 10
  • 26

2 Answers2

16

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

Community
  • 1
  • 1
Andrei Konstantinov
  • 6,971
  • 4
  • 41
  • 57
  • 3
    Bullet point 3 is incorrect -- xibs ARE supported: https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/DeployingSizeClassesonEarlieriOSVersions.html#//apple_ref/doc/uid/TP40014436-CH13-SW1 – Austen Chongpison Jun 29 '15 at 21:22
  • 1
    @Austen edited it. Now point 3 is correct : "Size classes are specified in a storyboard or xib file" – Martin Aug 25 '15 at 09:04
  • Thanks for the correction. Size classes are really supported in xibs for iOS 7.0 too, starting from XCode 6.1.1. But limitations on backwards compatibility is still apply. – Andrei Konstantinov Sep 03 '15 at 21:33
0

No I'm afraid that Size Classes were introduced in iOS 8. You could write some conditional code to run on iOS to determine the screen/view size/orientation and change the the layout that way when iOS 8 becomes your minimum target the conditional code can be removed.

Joseph Lord
  • 6,446
  • 1
  • 28
  • 32
  • I suppose I didn't say it, but I was referring to the backwards compatibility of size classes. For my project I did end up making iOS 8 the minimum supported version. As a sidenote, I found this [link](http://swiftiostutorials.com/backward-compatibility-ios-size-classes/) just now talking about what I believe was my issue above. – Kurt Anderson Jan 15 '15 at 17:19