Search code examples
iphoneuinavigationbarpermanentrightbarbuttonitem

want to add UInavigationBar rightBarButton like 'Now Playing' button of ipod, which doesnot disappears between view Transitions


i am new to iphone dev, i want to add a button (sign out) which remains fixed on the navigation bar's right side for every view.i.e. even when tabs of TabBar are tapped, the Sign Out button should remain fixed.

Any help/suggestions would be appreciated. Thanks


Solution

  • Since each UIViewController has its own navigation item (a set of views in the navigation bar), you have to add the same button in each view controller's -viewDidLoad method. If the same button is used everywhere in your app, it makes sense to create a subclass of UIViewController which does just that and reuse this subclass throughout your app.