UIButton for tabbar?
can we use UIButton instead of Tabbarcontrollers and assign that button to viewcontrollers , is it possible?any tutorial please?
how to creat开发者_运维百科e series of buttons like tabbarcontroller?how can i bring them in front of UIWindow, every viewcontroller must work above that series of buttons like tabbarcontroller?
first you have to add UITabbarController.
IBOutlet UITabBarController *tabbar;
IBOutlet UIButton *btnnewreport;
now add UIbutton to that tabbar controller's view so its display on that. and write code show controller on that button click.
-(void)viewdidload{
[tabbar.view addSubview:btnnewreport];
[tabbar setSelectedIndex:0];
}
-(IBAction)buttonclick:(id)sender{
[tabbar setSelectedIndex:1];
}
You could use a UIToolBar and include your buttons (or a segmented control) in it.. but then you'll have to write your own code to switch between views.. You can check UICatalog code sample to know how to use a tool bar and segmented control..
As far as showing every view above those buttons, i think you can use a base view controller with the tool bar and add all your views (to be selected by the tool bar buttons) as the base view's subviews..
But I'm not sure why you would want to go through all that trouble when a tab bar is readily available.. it is limited in terms of showing colored images .. but other than that it looks amazing.. you can even customize it within certain limits.. so you should probably rethink..
精彩评论