i have uiviewcontroller with navigation bar and a back button on him,and i try to set a method for this bac开发者_运维知识库k button with this :
UIBarButtonItem *rButton = [self.navigationItem leftBarButtonItem];
[rButton setAction:@selector(cancelCheck)];
and when I press the back button this method won't call
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelCheck)];
Try setting the target to self
(or whatever object that has the cancelCheck
selector)
[rButton setTarget:self];
精彩评论