Reputation:
I am using UITabBarController
so that it can be displayed on all views once declared in delegate
, but my requirement is that when any tab bar button clicked it should work like a button works on pushViewController
:. Is it possible, can anyone guide here.
Thanks in advance.
Upvotes: 1
Views: 98
Reputation: 6065
UINavigationController
with toolbar hidden. toolbar or custom view
on bottom and add buttons on it. push view controllers
which you want.Upvotes: 1
Reputation: 450
This is not a typical behavior, however you can try as follows:
Declare a delegate (UITabBarDelegate) for your UITabBar, and implement the method -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
to get notified of the user selecting tabs. In this method you will push a new view controller in the navigation controller's stack (or pop one that is not desired).
Depending on your needs, you may also need to manually set the currently selected tab bar item. To do so you can manipulate the tab bar's @property(nonatomic) NSUInteger selectedIndex
. Be aware that changing this property will trigger another call to tabBar:didSelectItem:
which may or may not be wanted.
Upvotes: 0