开发者

UInavigationbar with back button

开发者 https://www.devze.com 2023-03-25 13:26 出处:网络
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 :

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];
0

精彩评论

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