When creating a new nav-based iphone app, how do you add a button to the nav bar?
I’ve tried editing the rootviewcontroller.xib and adding a nav bar and nav item and bar button item, but it doesn’t seem to make any difference.
Is there a simple way of achieving this through IB, or do i have to duck into code somewhere?
Thanks
Unfortunately this requires a little bit of code. Create your
UIBarButtonItemin interface builder and hook it up to anIBOutletin your view controller. Then, inviewDidLoad:Assigning to
rightBarButtonItemworks similarly. See the UINavigationItem Class Reference for more information.