Reputation: 33048
MonoTouch is 5.2.12. iOS is v5.1.1 (Simulator)
Seems like I'm missing an important piece of a puzzle here.
I'm subclassing DialogViewController
and set it as the only controller in my UINavigationController.
In ViewWillAppear
of the subclassed DialogViewController
, I'm trying to set the left and right bar button items:
this.NavigationController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, this.HandleDoneButtonTouched );
Neither one of them is showing up. The title however is displayed. If I debug, I can see that the items are properly set.
I have also tried to use SetItems()
on the navigation controller: no effects either.
The navigation controller is presented modally in a page sheet.
Upvotes: 4
Views: 4182
Reputation: 7146
Navigation items are not usually updated through the navigation controller. Instead, they are updated via the NavigationItem property on the view controller:
this.NavigationItem.SetRightBarButtonItem(
new UIBarButtonItem(UIImage.FromFile("some_image.png")
, UIBarButtonItemStyle.Plain
, (sender,args) => {
// button was clicked
})
, true);
Upvotes: 7