简体   繁体   English

导航栏背景图片-支持iOS6和iOS7

[英]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? 根据iOS版本选择正确的导航栏背景图像的最佳做法是什么?

As I understand it, the image should be a height of 64px for iOS7 and 44px for iOS6. 据我了解,iOS7的图像高度应为64px,iOS6的图像高度应为44px。 Is it simply a matter of checking the iOS version running and then choosing the appropriate image (in an if statement)? 仅仅是检查iOS版本是否运行,然后选择适当的映像(在if语句中)吗? 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.)? 或者更好的是,有没有一种方法可以让iOS自动选择正确的图像(基于文件名等)?

Yes, use a different image for each version. 是的,为每个版本使用不同的图像。 You check check for iOS 6 with 您可以使用以下命令检查iOS 6的支票

NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1

Apple alludes to this solution in their iOS7 transition guide 苹果在其iOS7过渡指南中提到了该解决方案

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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