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
相关文章推荐
- ios UIView控件设置动画后添加点击事件不起作用
- 设置一个监听器监听多个按钮事件(点击按钮进入一个指定的网站)
- AlertDialog中使用自定义View,view中的Button如何设置点击事件监听
- iOS项目开发实战——监听对话框的按钮点击事件
- ListView 中设置setonitemclicklistener()监听时,无法获取item条目的点击事件焦点
- iOS UIView的点击事件与触摸手势
- AlertDialog中使用自定义View,其中的Button如何设置点击事件监听
- iOS 给UIView、UIImageView、UILabel添加点击事件
- Android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题解决
- 为 TextView 的部分文字设置超链接样式并监听点击事件
- android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题解决
- iOS 在添加了UITapGestureRecognizer的UIView上响应按钮的点击事件
- 解决 android设置软键盘搜索键以及监听搜索键点击时发生两次事件的问题
- iOS UIView 添加点击事件
- iOS 关于UIView的userInteractionEnabled属性(多层视图到点击事件)
- iOS 为移动中的UIView(UIButton )添加点击事件
- IOS UIView直接响应点击事件的解决方法
- IOS-监听UIAlertView按钮的点击事件
- IOS之UI--自定义按钮实现代理监听点击事件
- ios UIView 遮挡子控件点击事件