简体   繁体   中英

Navigation bar background image - supporting iOS6 and iOS7

What is the best practice for selecting the correct navigation bar background image depending on the iOS version?

As I understand it, the image should be a height of 64px for iOS7 and 44px for iOS6. Is it simply a matter of checking the iOS version running and then choosing the appropriate image (in an if statement)? Is there a way to do it in interface builder? Or better yet, is there a way to have iOS select the correct image automatically (based on the file name, etc.)?

Yes, use a different image for each version. You check check for iOS 6 with

NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1

Apple alludes to this solution in their iOS7 transition guide

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/Bars.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM