Uitoolbar *mytoolbar = [[Uitoolbar alloc] Initwithframe:cgrectmake (0.0f,0.0f,320.0f,80.0f)]; Nsmutablearray*mytoolbaritems =[Nsmutablearray array]; [Mytoolbaritems addobject:[[uibarbuttonitem Alloc]initwithtitle:@"Mytile"Style:uibarbuttonitemstyleplain target:self Action: @selector (Action)]]; [Mytoolbar Setitems:mytoolbaritems Animated:yes]; //-(ID) Initwithcustomview: (UIView *) CustomView//It can be seen that its parameters are a view, so we give it the ingredients to be correct oh, otherwise, you will wait for the loss of time Didadida. //a> plus a switch:[Mytoolbaritems addobject:[[uibarbuttonitem Alloc]initwithcustomview:[[uiswitch alloc] init]]; //b> plus a button uibarbuttonitemUibarbuttonitem*mybutton = [[Uibarbuttonitem alloc] Initwithtitle:@"MyButton"style:uibarbuttonitemstylebordered target:self Action: @selector (action)]; //get1button.width =;[Mytoolbaritems Addobject:mybutton]; //c> plus a text labelUILabel*mylabel = [[UILabel alloc] Initwithframe:cgrectmake (40.0f,20.0f,45.0f,10.0f)]; Mylabel.font=[uifont systemfontofsize:Ten]; //Mylabel.backgroundcolor = [Uicolor Clearcolor]; //Mylabel.textalignment=uitextalignmentcenter;Uibarbuttonitem*mybuttonitem =[[Uibarbuttonitem Alloc]initwithcustomview:mylabel]; [Mytoolbaritems Addobject:mybuttonitem]; //d> plus a progress bar UiprogressviewUiprogressview*myprogress = [[Uiprogressview alloc] Initwithframe:cgrectmake (65.0f,20.0f,90.0f,10.0f)]; Uibarbuttonitem*mybuttonitem1 =[[Uibarbuttonitem alloc]initwithcustomview:myprogress]; [Mytoolbaritems addobject:mybuttonitem1]; //you can use Initwithcustomview to make a variety of buttons, here is not one in the Add. I think you should also have mastered how to add a variety of buttonitem methods.
Use of IOS Uitoolbar