1

I am currently writing an iOS-APP based on mostly UITableViewControllers. The hierarchy is the following:

AppDelegate -> UINavigationController -> UITableViewController [A] -(didSelectRow: presentModalVC)-> UITabBarController -(contains multiple)-> UINavigationController -> UITableViewController [B]

Now when I try to add a navigationItem in UITableViewController [B] in the viewDidLoad method like so:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(composeTweet:)];

the navigationItem does not show.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
agrafix
  • 765
  • 1
  • 5
  • 15
  • Is it possible that someone else is setting rightBarButtonItem after your line of code? Try setting a breakpoint in, say, viewDidAppear and logging the value of the rightBarButtonItem. – Jesse Rusak Aug 26 '12 at 14:14
  • I put a breakpoint into viewDidAppear and I logged the rightBarButtonItem - it is set to the correct value... – agrafix Aug 26 '12 at 14:39

1 Answers1

0

Try self.navigationController.navigationItem.rightBarButtonItem

Also, try NSLogging the UINavigationController to see if it's nil or not.

max_
  • 24,076
  • 39
  • 122
  • 211
  • self.navigationController and self.navigationItem are not nil. The code you suggested doesn't work. – agrafix Aug 26 '12 at 14:42