Uitabbar is very common, it can achieve multiple pages of fast switching, and looks simple and practical.
Suppose I have several initialized Viewcontroller, and then I need to add them to the Tabbarcontroller and set it to the root view
Nsarray *views = [[Nsarray alloc] initwithobjects:test, time, Test1, Test2, Test3,
test4, nil];
Uitabbarcontroller *TBC = [[Uitabbarcontroller alloc] init];
Tbc.viewcontrollers = views;
Self.window.rootViewController = TBC;
After you set it up, look at the Tabbar's effect chart.
The item for each view here has a few attributes, titles title, image Image, and the circle icon on the right of time that shows Badgevalue. You can set its Tabbaritem property when you overwrite the view's initialization method.
-
(ID) initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil
{
self = [super Initwithnibname:nibnameornil Bundle:nibbundleornil];
if (self) {
self.tabBarItem.title = @ "Time";
Self.tabBarItem.image = [UIImage imagenamed:@ "Time.png"];
Self.tabBarItem.badgeValue = [NSString stringwithformat:@ '%d ', 3];
}
return self;
}
Again look at the far right of the effect chart, it is more, this is because Tabbar defaults to display up to 5 item, superfluous will automatically add to more, click More will pop up a navigationbar, there is an edit button
Click Edit
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/