Size Classes in iOS 7
Asked Answered
V

2

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.

Violative answered 3/11, 2014 at 3:21 Comment(0)
W
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://mcmap.net/q/23811/-how-can-xcode-6-adaptive-uis-be-backwards-compatible-with-ios-7-and-ios-6

Weekday answered 15/4, 2015 at 8:37 Comment(3)
Bullet point 3 is incorrect -- xibs ARE supported: developer.apple.com/library/ios/recipes/…Ragout
@Austen edited it. Now point 3 is correct : "Size classes are specified in a storyboard or xib file"Wymore
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.Weekday
I
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.

Invalidate answered 14/1, 2015 at 16:17 Comment(1)
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 just now talking about what I believe was my issue above.Violative

© 2022 - 2024 — McMap. All rights reserved.