您的位置:首页 > 产品设计 > UI/UE

iOS 为UIView设置点击监听事件

2014-08-14 19:44 1536 查看
// 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 view

UIView *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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: