0

所以我正在阅读转换指南,如果我使用故事板,我可以有条件地为 iOS6 或 iOS7 加载资产。我正在使用它,但我不明白如何将资产加载到故事板中。

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/SupportingEarlieriOS.html

4

1 回答 1

1

你可以使用这些:

/** iOS Version Comparisons */
#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)


if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ) 
    // do something for iOS 7
else
    // do something for iOS 6, 5, 4

你也可以像这样使用它:

[myButton setBackgroundImage:( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? @"image_ios7" : @"image_ios6" )];
于 2013-09-24T20:16:12.393 回答