iPad模拟器/设备使用iPhone故事板
发布时间:2020-12-14 18:02:26 所属栏目:百科 来源:网络整理
导读:所以我已经为iPhone创建了一个应用程序,我希望通过这个 answer的步骤将其转换为iPad. 复制您的iPhone-Storyboard并将其重命名为MainStoryboard_iPad.storyboard 打开此文件任何文本编辑器. 搜索targetRuntime =“iOS.CocoaTouch”并将其更改为targetRuntime
所以我已经为iPhone创建了一个应用程序,我希望通过这个
answer的步骤将其转换为iPad.
>复制您的iPhone-Storyboard并将其重命名为MainStoryboard_iPad.storyboard 一切都做得很好,但iPad模拟器/设备无论如何都使用iPhone故事板.有什么建议? 我在摘要中设置了iPad故事板 – > ipad部署信息 – >主故事板.和main.plist->主故事板文件基本名称(iPad)设置为iPad故事板. 请告诉我我错过了什么. UPD.有趣的是,当我从ipad部署信息中删除iPad故事板名称时,它仍然在设备上使用我的iPhone故事板. 解决方法
您总是可以在appDelegate中选择正确的故事板,并以编程方式显示相应的根视图控制器
@interface AppDelegate : UIResponder <UIApplicationDelegate> { UIViewController *rvc; } 履行 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IPAD_Storyboard" bundle:nil]; rvc = [storyboard instantiateViewControllerWithIdentifier:@"identifierForController"]; } else { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; rvc = [storyboard instantiateViewControllerWithIdentifier:@"identifierForController"]; } [self.window addSubview:rvc.view]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |