我正在尝试在我的 UIView 上添加一个 UITapGestureRecognizer。这是我的 UIViewController 代码的一部分。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Create and initialize a tap gesture
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondToTapGesture:)];
// Specify that the gesture must be a single tap
tapRecognizer.numberOfTapsRequired = 1;
// Add the tap gesture recognizer to the view
[self.view addGestureRecognizer:tapRecognizer];
}
-(void) respondToTapGesture:(UITapGestureRecognizer *)gr {
NSLog(@"It's working !");
}
问题是当我点击视图时,我收到以下消息:
0x396e25d0: ldr r3, [r4, #8] < Thread 1 : EXC_BAD_ACCESS (code=1, address=0x8)
有人有想法吗?