我正在尝试使用
推送控制器但适用于通用应用
我必须写..
if([[UIDevice current]UserInterfaceIdiom] == UIUserInterFaceIPad)
{
MyViewController *controller = [[MYViewController alloc]initWithNibName:@"MyViewController_IPad"];
[self.navigationCOntroller pushViewController:myViewController animated:YES];
else{
MyViewController *controller = [[MYViewController alloc]initWithNibName:@"MyViewController_IPhone"];
[self.navigationCOntroller pushViewController:myViewController animated:YES];
}
我可以获得解决方案来克服“如果” 条件并避免设备检查..
答案 0 :(得分:2)
制作两个笔尖,一个用于iPhone,另一个用于iPad,将它们命名为MyViewController~iphone.xib
和MyViewController~ipad.xib
(注意:匹配案例非常重要!)。确保它们都已添加到您的目标中,然后在您的代码中执行:
MyViewController *controller = [[MYViewController alloc]initWithNibName:@"MyViewController"];
[self.navigationCOntroller pushViewController:myViewController animated:YES];