我創建了一個的UITabBarController這樣的:爲什麼我的UITabBarController是空的?
InfoViewController *iVC = [[InfoViewController alloc] init];
self.infoViewController = iVC; // retain property
UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:0];
self.infoViewController.tabBarItem = tabBarItem;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:myVC];
self.navigationController = nc;
UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMostRecent tag:1];
self.navigationController.tabBarItem = tabBarItem;
UITabBarController *tbc = [[UITabBarController alloc] init];
NSArray* controllers = [NSArray arrayWithObjects:self.infoViewController, self.navigationController, nil];
self.tabBarController = tbc; // retain property!
self.tabBarController.viewControllers =控制器; [tbc release];
問題:我在底部看到一個黑色的標籤欄和一個白色的內容區域。數組中的第一個視圖控制器具有紅色背景色。所以它應該顯示爲紅色。
選項卡欄不顯示任何項目,它是空的。
可能是什麼問題?我不使用nib文件...沒有警告,沒有錯誤,沒有記錄到控制檯。只需清空選項卡欄。
對,我忘了複製並粘貼到這裏。但這不是原因。 – openfrog 2010-01-26 16:32:26
看到我更新的答案 – 2010-01-26 17:16:41