博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS手势学习UIGestureRecognizer & cocos2d 手势推荐
阅读量:6555 次
发布时间:2019-06-24

本文共 1892 字,大约阅读时间需要 6 分钟。

iOS手势学习UIGestureRecognizer & cocos2d 手势推荐

手势识别类型:

   // 长按

      // 慢速拖动
     // 两指向內或向外拨动
     // 旋转
      // 快速滑动
       // 点击

手势协议:

@protocol UIGestureRecognizerDelegate 
@optional// called when a gesture recognizer attempts to transition out of UIGestureRecognizerStatePossible. returning NO causes it to transition to UIGestureRecognizerStateFailed- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;// called when the recognition of one of gestureRecognizer or otherGestureRecognizer would be blocked by the other// return YES to allow both to recognize simultaneously. the default implementation returns NO (by default no two gestures can be recognized simultaneously)//// note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;// called before touchesBegan:withEvent: is called on the gesture recognizer for a new touch. return NO to prevent the gesture recognizer from seeing this touch- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;@end

手势优先级:

// create a relationship with another gesture recognizer that will prevent this gesture's actions from being called until otherGestureRecognizer transitions to UIGestureRecognizerStateFailed// if otherGestureRecognizer transitions to UIGestureRecognizerStateRecognized or UIGestureRecognizerStateBegan then this recognizer will instead transition to UIGestureRecognizerStateFailed// example usage: a single tap may require a double tap to fail- (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer;

各种手势Demo:

cocos2d手势库推荐:  

转载地址:http://qatco.baihongyu.com/

你可能感兴趣的文章
业务对象和BAPI
查看>>
程序源系统与当前系统不一致:Carry out repairs in non-original systems only if urgent
查看>>
微软职位内部推荐-Senior Software Engineer
查看>>
程序中的魔鬼数字
查看>>
SVN高速新手教程
查看>>
session cookie
查看>>
如何在Vblock里配置Boot from SAN
查看>>
ZBar之ZBarReaderViewController
查看>>
Nuget~管理自己的包包~丢了的包包快速恢复
查看>>
Hadoop单机模式安装-(3)安装和配置Hadoop
查看>>
$.extend({},defaults, options) --(初体验三)
查看>>
自己主动瀑布流布局和实现代码加载
查看>>
maven的一些依赖
查看>>
腾讯云短信服务使用记录与.NET Core C#代码分享
查看>>
jQuery hover() 方法
查看>>
sql语句
查看>>
android 一步一步教你集成tinker(热修复)
查看>>
到底有多少内存
查看>>
centos7.3 安装ovirt-engine4.0 版本
查看>>
putty、xshell的密钥认证
查看>>