ign*_*rum 5 iphone xcode objective-c ipad
所以,我创建了针对iPhone的应用程序,我想将它转换到iPad,按照此步骤的答案.
复制您的iPhone-Storyboard并将其重命名为MainStoryboard_iPad.storyboard
打开此文件任何文本编辑器.
搜索targetRuntime ="iOS.CocoaTouch"并将其更改为targetRuntime ="iOS.CocoaTouch.iPad"
现在保存所有内容并重新打开Xcode - > iPad-Storyboard包含与iPhone文件相同的内容,但每一个都可能被排除在外
一切都做得很好,但iPad模拟器/设备无论如何都使用iPhone故事板.有什么建议?
我在摘要中设置了iPad故事板 - > ipad部署信息 - >主要故事板.并且main.plist->主故事板文件基本名称(iPad)设置为iPad故事板.
请告诉我我错过了什么.
UPD.有趣的是,当我从ipad部署信息中删除iPad故事板名称时,它仍然在设备上使用我的iPhone故事板.



您始终可以在 appDelegate 中选择正确的 Storyboard 并以编程方式呈现适当的根视图控制器
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UIViewController *rvc;
}
Run Code Online (Sandbox Code Playgroud)
执行
- (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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2356 次 |
| 最近记录: |