我使用此代碼來適應我的故事板根據設備(iPhone 5或更少):iPhone 5的屏幕適應
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
:
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]];
}}
的代碼不能使用,即使我只是工作的地方
...它仍然加載iPhone正常。
我把它放在:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
在應用程序委託。這是正確的嗎??在應用設置中,我選擇故事情節
目標上的摘要頁的故事板可能設置爲MainStoryboard_iPhone –