user1573321
user1573321

Reputation:

Can we use the UINavigationController animation on UITabBarController

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

Answers (2)

Mert
Mert

Reputation: 6065

  • you can just create a UINavigationController with toolbar hidden.
  • Then create a root view controller which has toolbar or custom view on bottom and add buttons on it.
  • Add targets to that buttons to push view controllers which you want.

Upvotes: 1

micamoita
micamoita

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

Related Questions