繁体   English   中英

如何有条件地为iOS7和iOS6加载资产?

[英]How do I conditionally load assets for iOS7 and iOS6?

因此,我正在阅读过渡指南,如果我使用情节提要,则可以有条件地为iOS6或iOS7加载资产。 我正在使用它,但是我不明白如何将资产加载到故事板上。

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

您可以使用这些:

/** 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" )];

暂无
暂无

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

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