开发者

Why is self.navigationItem.backBarButtonItem always nil?

I push a view controller onto a navigation controller like this:

[self.navigationController pushViewController:anotherViewController anima开发者_如何学Cted:YES];

And, then, inside anotherViewController I check self.navigationItem.BackBarButtonItem and LeftBarButtonItem, but they are always nil.

I can see the backBarButtonItem, and it seems to work fine.


From the Documentation: "When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a back button on the navigation bar. Use this property to specify the back button. The target and action of the back bar button item you set should be nil. The default value is a bar button item displaying the navigation item’s title."

I'm taking this to mean that it is convention for it to always be nil, and that the default value is always nil.

A similar subject about self.navigationItem.backBarButtonItem being nil was discussed here: Changing the UIBackButtonItem title

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜