来自Xcode的选项卡式应用程序起点shell无法在5.1 / 5.0中运行

时间:2013-01-31 17:12:55

标签: iphone ios xcode

当我使用Xcode版本4.5.2(4G2008a)为通用应用程序5.0及更高版本创建新的“选项卡式应用程序”时,它在6.0模拟器上运行良好,但在5.1或5.0上运行不正常。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{   
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    UIViewController *viewController1;
    UIViewController *viewController2;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil];
        viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil];
    } else {
        viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController_iPad" bundle:nil];
        viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController_iPad" bundle:nil];
    }

    self.tabBarController = [[UITabBarController alloc] init];
    **self.tabBarController.viewControllers = @[viewController1, viewController2];**
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

这是断点捕获的地方      self.tabBarController.viewControllers = @ [viewController1,viewController2];

我对苹果设置没有任何改变。我看过,但也许我在谷歌搜索错误的东西。

enter image description here

1 个答案:

答案 0 :(得分:0)

它是因为xib文件中的auto布局属性。转到两个xib文件,在右侧菜单中单击选中视图时顶部的第一个选项卡,然后取消勾选使用自动布局文本框。

enter image description here

希望这有助于。

萨姆