iOS 为UIView设置点击监听事件

来源:互联网 发布:php解析json数据 编辑:程序博客网 时间:2024/05/17 21:18
// In the view controller where you create the subviews// (not sure from your question, but I think you are adding image views to a scroll viewUIView *view = [[UIView alloc] init];UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];[view addGestureRecognizer:tap];
- (void)imageViewTapped:(UITapGestureRecognizer *)gr {    UIImageView *theImageViewThatGotTapped = (UIImageView *)gr.view;}

转载自:http://stackoverflow.com/a/9986230/3458781

0 0
原创粉丝点击