動態創建標簽欄控制器就不說了,就是從視圖庫中托一些控件,這裡要用到得是Tab Bar Controller,然後創建兩個插座變量跟拖的控件進行關聯。現在我們主要講一下怎麼對Tab Bar Controller進行設置:
(1)設置條目標題
self.title = @"第一個視圖"; [self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],UITextAttributeTextColor,[UIFont fontWithName:nil size:18],UITextAttributeFont, nil] forState:UIControlStateNormal];
(3)自定義添加圖片
UITabBarItem *t1 = [[UITabBarItem alloc]initWithTitle:@"Forward" image:[UIImage imageNamed:@"forward.png"] tag:1]; self.tabBarItem = t1;