I have an app delegate, which is also UINavigationControllerDelegate (and I’ve tried setting it as UITabBarControllerDelegate and UITabBarDelegate before asking, if that would trigger something to work, but…).
In mainwindow.xib, I have a tab bar with 6 items, which become split up into 4 + a more tab, which goes to the standard view with the two remaining tabs (in a list).
This tab bar has a controller which is the root controller over the nav controller, and called rootCt.
Now, the problem is that selected the tabs in the More nav ctlr makes the selected viewcontroller’s title nil, showing “Item” instead of the tab title.
I would like to get the title as set in IB, as I’ve made localized nibs. Ie., simply the title that you click on in the More view.
I’ve tried:
UITabBarItem *item=[[appd rootCt].tabBar.items objectAtIndex:4];
NSString *str=[item title];
self.title=str;
But this gives nil. Changing index to 3 gives the 3rd title correctly, and 5 results in a crash.
Tried:
NSString *str=[appd rootCt].selectedViewController.title;
This also gives nil, because it’s not set yet – that’s what I need to set in this code.
I can’t use selectedViewController.title, as that’s nil and that’s what I’m trying to set. Right?
How do I get the selected tab title coming from the More view? Should it be this hard?? Or have I missed something obvious…
It must have been a lost outlet reference or similar. Deleting the .xib and redoing the work solved it.