我正在使用此代码根据设备(iphone 5 或更少)调整我的故事板:
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
if(UIScreenOverscanCompensationScale==1136/640){
//move to your iphone5 storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
}
else{
//move to your iphone4s storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
}}
即使我只是放置,代码也不起作用:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
...它仍然正常加载 iphone。
我把它放在:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
在应用程序委托中。这是正确的吗??在应用程序设置中,我选择了原始的 iphone 故事板