条形按钮的动作侦听器不会被调用

时间:2017-08-04 10:15:08

标签: ios objective-c uibarbuttonitem

在我的ViewController中我有一个barButton,我为它创建了一个监听器,如下面发布的代码所示。

在运行时,当我单击barButton时,条形图中的日志消息按钮操作方法onBarButtonPressed doe snot display。

请告诉我如何为条形按钮创建动作监听器?

#import "ViewController.h"

 @interface ViewController ()

 @end

@implementation ViewController

- (void)viewDidLoad {
 [super viewDidLoad];
 // Do any additional setup after loading the view, typically from a  
 nib.

 [self collectValues];
}


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
 // Dispose of any resources that can be recreated.
}

- (IBAction)onBarButtonPressed:(id)sender {
NSLog(@"CLICKED");
}

- (void) collectValues {
self.textFieldValueToDispatch;
}

@end

图片

enter image description here

1 个答案:

答案 0 :(得分:0)

检查连接检查器中发送的操作。您已在屏幕截图enter image description here

中触发了一个条形按钮