UITabBarController没有在iphone 5模拟器上工作,我使用xib所以没有mainwindow.xib

Anu*_*bra 0 uitabbarcontroller ios ios6 iphone-5

我添加了代码来制作带有导航功能的tabbar应用程序.

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization




        ChatVC *objChatVC = [[ChatVC alloc]init];
        UpdateMeContactVC *objUpdateMeContact = [[UpdateMeContactVC alloc]init];
        cardsVC *objCardsVC = [[cardsVC alloc]init];
        settingVC *objSettingVC = [[settingVC alloc]init];
        NotificationVC *objNotificationVC = [[NotificationVC alloc]init];

        self.objNavConChat = [[UINavigationController alloc]initWithRootViewController:objChatVC];
        self.objNavConContact = [[UINavigationController alloc]initWithRootViewController:objUpdateMeContact];
        self.objNavConCards = [[UINavigationController alloc]initWithRootViewController:objCardsVC];
        self.objNavConNotification = [[UINavigationController alloc]initWithRootViewController:objNotificationVC];
        self.objNavConSetting = [[UINavigationController alloc]initWithRootViewController:objSettingVC];
        self.objTabBarController = [[UITabBarController alloc]init];

        self.objNavConChat.title = @"Chat";
        self.objNavConContact.title = @"Contacts";
        self.objNavConCards.title = @"Cards";
        self.objNavConNotification.title = @"Notification";
        self.objNavConSetting.title = @"Setting";

        self.objNavConChat.tabBarItem.image = [UIImage imageNamed:@"online_chat.png"];
        self.objNavConCards.tabBarItem.image = [UIImage imageNamed:@"card.png"];
        self.objNavConContact.tabBarItem.image = [UIImage imageNamed:@"contact.png"];
        self.objNavConNotification.tabBarItem.image = [UIImage imageNamed:@"notification.png"];
        self.objNavConSetting.tabBarItem.image = [UIImage imageNamed:@"settings.png"];


        objTabBarController.viewControllers = [NSArray arrayWithObjects:objNavConChat,objNavConCards,objNavConContact,objNavConNotification,objNavConSetting, nil];
        objTabBarController.selectedIndex=2;
        [self.view addSubview:self.objTabBarController.view];





    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

并在updatemecontact我使用tableviewon scrollview和我的xib是3.5英寸,但当我运行程序时,tabbar不起作用.我无法在tabbar上选择任何选项.

Moh*_*abi 8

转到MainWindow.xib,选择Window对象并选中"启动时全屏".

在此输入图像描述