One is to set tabbarviewcontroller in appdelegate and then use self. View controllers add another view con
The two types are inherited from the tabbarviewcontroller class, and then the VC class is added to it,
A simple tabbar background color, as well as the items font and image, is to draw a tabbar background image with a length, width, and height of 320 and a length of 49, divide it into several pieces and PS the items content and images. In this way, you can set the tabbar background,
[Self. tabbar setbackgroundimage: [uiimage imagenamed: @ "tab_bg.png"];
In addition, when you click items, the animation is generated. The simple method is to set an image, add it to the tabbar, and then add it, button, and loop through a button to load the tabbar, use the button click event to change the Image Location
Code
Uiimageview * _ selectedtag = [[[uiimageview alloc] initwithimage: [uiimage imagenamed: @ "tabbar_tag.png"] autorelease];
[_ Selectedtag setframe: cgrectmake (31, 15, 20, 19)]; [self. tabbar addsubview: _ selectedtag]; for (INT I = 0; I <5; I ++) {uibutton * tabbutton = [[uibutton alloc] initwithframe: cgrectmake (20 + I * 56, 0, 56, 49)] autorelease]; tabbutton. tag = I; [tabbutton addtarget: Self
Action: @ selector (tabbuttontapped :) forcontrolevents: uicontroleventtouchupinside]; [self. tabbar addsubview: tabbutton];}
Add them to the tabbar and call the method.
-(Void) tabbuttontapped :( uibutton *) sender {
Self. selectedindex = sender. Tag ;//
// Click the image movement event and the tabbar event.
// If (self. selectedindex = channlemore) {// uinavigationcontroller * morenav = (uinavigationcontroller *) self. selectedviewcontroller; // [morenav poptorootviewcontrolleranimated: No]; //} [uiview animatewithduration :. 2 animations: ^ {[_ selectedtag setframe: cgrectmake (31
+ 60 * sender. Tag,-15, 20, 19)] ;}] ;}
The above is the simple use of tabbar,
If you do not need an image to replace the settings of the control, you can set the itmes of tabbar as follows:
[[Self. tabbar. Items objectatindex: 0] settitle: @ "Homepage"]
You can also set the background, image, and font,
Similarly, uinavigationcontroller can be implemented in the same way, that is, hiding uinavigationcontroller. navigationbarhidden = yes; and then creating the navigation bar by yourself,
The method is similar to that of tabbar,
The above is the simple use of the method