Ios iPhone5屏幕调整
我使用此代码根据设备(iphone 5或更低版本)调整情节提要: 即使我只放置以下位置,代码也不起作用:Ios iPhone5屏幕调整,ios,xcode,Ios,Xcode,我使用此代码根据设备(iphone 5或更低版本)调整情节提要: 即使我只放置以下位置,代码也不起作用: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]]; …它仍然正常加载iphone 我把它放在: - (BOOL)application:(UIApplication *)application didFinishLau
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
…它仍然正常加载iphone
我把它放在:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
应用程序内代理。是这样吗??在应用程序设置中,我选择了原始的iphone情节提要,问题在于:
UIScreenOverscanCompensationScale==1136/640
永远不会是真的
检查UIScreenOverscanCompensationScale正在执行的操作并返回BOOL。是否仍在目标摘要下指定了
MainstryBoard
?我相信这将是应用程序的第一个外观。我通过以下方式解决了这个问题:
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568.0){
//move to your iphone5 storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
// Set root view controller and make windows visible
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}
else{
//move to your iphone4s storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
// Set root view controller and make windows visible
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}}
在Targets Summary页面上,故事板可能设置为MainstryBoard_iPhonewell,我已经决定在Summary=>main storyboard下创建一个故事板。因为我必须决定一个故事板。
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568.0){
//move to your iphone5 storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iphone5 storyboard" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
// Set root view controller and make windows visible
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}
else{
//move to your iphone4s storyboard
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
// Set root view controller and make windows visible
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
}}