开发者

ParentViewController returns nil

I know there are many questions o开发者_JAVA技巧n this, but I don't get it to work.

I present a UITabBarController with the presentModalViewController. However when I try to get title from the navigationItem title attribute in the UINavigationController class that presents the tabcontroller, it returns nil no matter what I do. I have the NSLog in the viewDidLoad method in tabcontroller class.

I also cast the UIViewController which is returned by the self.parentViewController property. Then I try to access the title through: NSLog(@"%@", castedViewController.navigationItem.title);

Any suggestions?


you talking about two different thing. The first is a UITabBarController, the thing you have at the bottom two or more buttons. The second thing is a UINavigationController which is on the top of each view presenting a title and a back button.
If you present the tabBar modally then you would not get a back button, you should push it instead. (something like navigationController-pushView can't name it exactly for now).

Anyway try not to call the navigationItem.title but instead navigationBar.topItem.title

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜