ナビゲーション機能を備えたタブバー アプリケーションを作成するコードを追加しました。
- (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;
}
updatemecontact では、スクロールビューでテーブルビューを使用しており、xib は 3.5 インチですが、プログラムを実行するとタブバーが機能しません。タブバーでオプションを選択できません。