由於我沒有使用xib文件,並且不知何故,我的代碼結構根本沒有幫助我,所以我正面臨更改標籤欄顏色的麻煩,告訴我是否需要重寫整個事情從頭開始然而,如果我沒有^^^在沒有xib文件的情況下更改我的標籤欄顏色
我會非常感激這是我的appDelegate文件的單個視圖應用程序,在這裏我創建與導航欄相關聯的標籤欄每個選項卡,然後顯示這些
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
self.firstTab = [[FirstTab alloc] initWithNibName:nil bundle:NULL];
self.firstNavigationController = [[UINavigationController alloc] initWithRootViewController:self.firstTab];
self.thirdTab = [[ThirdTab alloc] initWithNibName:nil bundle:NULL];
self.thirdNavigationController = [[UINavigationController alloc] initWithRootViewController:self.thirdTab];
self.tab2 = [[newsecViewController alloc] initWithNibName:@"newsecViewController" bundle:NULL];
self.tab2NavigationController = [[UINavigationController alloc] initWithRootViewController:self.tab2];
self.tab2.view.backgroundColor = [UIColor purpleColor];
//NSArray *tabs = [[NSArray alloc] initWithObjects:self.firstTab, self.secondTab, self.thirdTab, nil];
NSArray *tabBars = [[NSArray alloc] initWithObjects:self.firstNavigationController, self.tab2NavigationController, self.thirdNavigationController, nil];
self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController setViewControllers:tabBars];
[self.window addSubview:self.tabBarController.view];
這是我的選項卡之一的碼樣本
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self != nil) {
self.title = @"Second";
self.tabBarItem.image = [UIImage imageNamed:@"triangle.png"];
}
return self;
感謝所有您的幫助...
你想改變哪種顏色?所有選項卡的整體顏色或所選選項卡圖像的色調?哪個版本的iOS? – rmaddy