as my title, how do i add in a rightbarbuttontiem in a specific view of tabbarcontroller ?
i’m using storyboard to create the tabarcontroller.
i tried this but the item are not displayed
UIBarButtonItem *settingButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"gear.png"]
style:UIBarButtonItemStylePlain
target:self
action:@selector(pushToSetting)];
//BarButtonItem *settingButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)];
self.navigationItem.rightBarButtonItem = settingButton;
Are you using a NavigationController? If you are, then your code should work. If you are using just a UINavigationBar, then you have to set the items property for the UINavigationBar. As you are not getting a rightbuttonitem, I assume you are using a UINavigationBar. This code should work:
You should have the rightbarbuttonitem now. Here, navBar is a UINavigationBar outlet. You can also pop and push navigation items onto a UINavigationBar using these methods: