我想为三个不同的设备(iphone4s、iphone5 和 ipad)调用 UIStoryboard。我新添加了 iphone4s 设备。我有以下情节提要
- 主要_iPhone
- Main_iPhone4(新增)
- Main_iPad
请检查我当前的来源。它与iphone5一起工作。
AVCamViewController *vc = [[UIStoryboard
storyboardWithName:@"Main_iPhone" bundle:NULL]
instantiateViewControllerWithIdentifier:@"rootController"];
vc.modalPresentationStyle = UIModalPresentationFormSheet;
vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.viewControllerCam presentViewController:vc animated:YES completion:nil];
我需要像下面这样进行更改,并且我使用 iphone4s 设备运行。但我仍然看到“Main_iPhone”故事板。当我在 iphone4s 设备中运行时,请帮助我如何切换 Main_iPhone4。
UIStoryboard *storyboard = nil;
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
{
CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
if (iOSDeviceScreenSize.height == 480)
{
storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone4" bundle:nil];
}
if (iOSDeviceScreenSize.height == 568)
{
storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
}
}
else if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
storyboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil];
}
AVCamViewController *vc = [storyboard instantiateInitialViewController];
vc.view.backgroundColor = [UIColor clearColor];
vc.modalPresentationStyle = UIModalPresentationFormSheet;
vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.viewControllerCam presentViewController:vc animated:YES completion:nil];