开发者

Is there a naming convention for a navigation controller?

开发者 https://www.devze.com 2023-01-06 18:36 出处:网络
When I try to push a view controller to my UINavigationController I get a NSInvalidArgumentException thrown with the error message \"unrecognized selector sent to instance\".But this only happens when

When I try to push a view controller to my UINavigationController I get a NSInvalidArgumentException thrown with the error message "unrecognized selector sent to instance". But this only happens when I name开发者_StackOverflow my UINavigationController ivar anything other than "navigationController". Is there a reason for this?


Not sure how your code is structured, but every UIViewController has a navigationController property. (See http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html)

So, [self navigationController] is returning the property from the current view controller (whatever self is), not what you've named in your AppDelegate.

0

精彩评论

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