if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[[_ViewController alloc] initWithNibName:@"_ViewController_iPhone" bundle:nil] autorelease];
} else {
self.viewController = [[[_ViewController alloc] initWithNibName:@"_ViewController_iPad" bundle:nil] autorelease];
}<pre name="code" class="objc">self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];iOS 判断设备为iPhone还是iPad
最新推荐文章于 2021-02-01 05:35:30 发布
本文介绍了一种通过判断当前设备的用户界面模式(手机或平板),来动态选择加载不同ViewController的方法,适用于iOS应用开发。
1831

被折叠的 条评论
为什么被折叠?



