Loading Resources Conditionally
In some cases, you need to determine the iOS version your app is currently running in so you can respond to version differences appropriately in code. For example, if different versions of an app use significantly different layouts, you can load different storyboard or XIB files for each version. You may also need to use different code paths to handle API differences, such using
barTintColor instead of tintColor to tint a bar’s background.
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your
Info.plist file—you can use the version of the Foundation framework to determine the current system version and load the appropriate resource inapplication:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {// Load resources for iOS 6.1 or earlier} else {// Load resources for iOS 7 or later}
コメント
コメントを投稿