A specific StoryBoard for iOs 7 [duplicate]

旧巷老猫 提交于 2020-01-03 02:27:10

问题


I'd like to optimize my app on iOs7 but this is really hard. Xcode looks pretty buggy...

Do you know if it is possible to have 2 storyboards, one for iOs7 and the other for older versions ?

Thanks a lot !


回答1:


Here's what you need to do. Put this type of logic in your applicationDidFinishLaunchingWithOptions: method of your app delegate:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define iOS_7_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:iOS_7_OR_LATER ? @"Storyboard-iOS7" : @"MainStoryboard" bundle:nil];
self.window.rootViewController = [storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];


来源:https://stackoverflow.com/questions/18743623/a-specific-storyboard-for-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!