IOS 手势UIGestureRecognizer --- 可用于 很炫的 事务类应用 ,作为 增删改查的 手段
2013-05-25 09:55
260 查看
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. UIView *tempView1 = [[[UIView alloc] initWithFrame:self.view.bounds] autorelease]; [tempView1 setBackgroundColor:[UIColor blueColor]]; [self.view addSubview:tempView1]; UIView *tempView2 = [[[UIView alloc] initWithFrame:self.view.bounds] autorelease]; [tempView2 setBackgroundColor:[UIColor orangeColor]]; [self.view addSubview:tempView2]; UITapGestureRecognizer *tapGestureTel1 = [[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickH:)]autorelease]; UITapGestureRecognizer *tapGestureTel2 = [[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickH:)]autorelease]; // Set required taps and number of touches //一个手指,拍击两次手势 [tapGestureTel2 setNumberOfTapsRequired:2]; [tapGestureTel2 setNumberOfTouchesRequired:1]; //两个手指,拍击两次手势 [tapGestureTel2 setNumberOfTapsRequired:2]; [tapGestureTel2 setNumberOfTouchesRequired:2]; [tempView1 addGestureRecognizer:tapGestureTel1]; [tempView2 addGestureRecognizer:tapGestureTel2]; // 向上滑动 UISwipeGestureRecognizer *oneFingerSwipeUp = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(clickH:)] autorelease]; [oneFingerSwipeUp setDirection:UISwipeGestureRecognizerDirectionUp]; [tempView2 addGestureRecognizer:oneFingerSwipeUp]; // 向下滑动 UISwipeGestureRecognizer *oneFingerSwipeDown = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(clickH:)] autorelease]; [oneFingerSwipeDown setDirection:UISwipeGestureRecognizerDirectionDown]; [tempView2 addGestureRecognizer:oneFingerSwipeDown]; //旋转手势 UIRotationGestureRecognizer *twoFingersRotate = [[[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(clickH:)] autorelease]; [tempView2 addGestureRecognizer:twoFingersRotate]; //向里或向外捏的手势 UIPinchGestureRecognizer *twoFingerPinch = [[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(clickH:)] autorelease]; [tempView2 addGestureRecognizer:twoFingerPinch]; } -(IBAction)clickH:(id)sender { UIView *view = [[self.view subviews] objectAtIndex:1]; [self.view insertSubview:view atIndex:0]; //将当前的view放到最底部。 }
相关文章推荐
- 13款用于拍摄全景照片的iOS应用
- iOS手势应用举例
- Facebook 开源安卓版 React Native,开发者可将相同代码用于网页和 iOS 应用开发
- iOS开发UI篇—实现一个简单的手势解锁应用(基本) - 文顶顶
- 用于处理JDBC 增删等写操作的事务控制
- iOS SQLite增删改查(简单应用)
- iOS开发UI篇—实现一个简单的手势解锁应用(基本)
- 2011斯坦福大学iOS应用开发教程学习笔记(第五课)Protocols,手势识别
- cocos2d-x生成的ios应用和安卓应用的ID(用于区分不同应用的标识)
- 配置iPhone作为iOS应用调试工具
- iOS开发UI篇—实现一个简单的手势解锁应用(基本)
- IOS应用开发09——为自定义UITableViewCell的部分区域添加手势
- iOS基础8:自定义MyData/自定义SQLite用于网络判断,版本判断,图片缓存处理,下载或者上传的GET或POST请求,加密手段,.数据解析
- Appium+Robotframework实现iOS应用的自动化测试-6:手势密码的解决方案
- iOS用于内测或者不能在AppStore发布的应用发布平台
- IOS常见事件、手势的应用
- 2011斯坦福大学iOS应用开发教程学习笔记(第五课)Protocols,手势识别
- 在 iOS 应用中使用 Lua 作为模块粘合剂的方法
- 在 iOS 应用中使用 Lua 作为模块粘合剂的方法
- 2011斯坦福大学iOS应用开发教程学习笔记(第五课)Protocols,手势识别