手势传递我的笔记

手势笔记UIGestureRecognizerDelegate(重要重要的笔记)
1、-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
这个方法返回NO之后,-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
居然不调用了。导致手势不传递了。

2、stopPanGeusture 属性貌似没用,设置为YES还是NO对代理方法而言是一样的,其余的都会走,但是stopPanGeusture = YES的时候,- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 这个方法的pan手势会返回NO,阻止组件响应链往下传递。

3、gestureRecognizerShouldBegin 这个方法返回NO,也会走那个冲突方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
gestureRecognizerShouldBegin返回NO时,就表示UIGestureRecognizer.status = failed,也就是里面的手势方法,就不会走了,比如pan不会走,点击不会走,双击也会走

5、- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
这个返回NO,我觉得就是相当gestureRecognizerShouldBegin返回No(不是的,gestureRecognizerShouldBegin等于会走冲突方法),表示这个视图的手势废掉了,相当于enabled = NO
所以即使你的子视图的冲突方法设置为YES(允许手势冲突),传到了目前的这层,这层也会没有反应。

6、在视图上面哪些视图能有效果,哪些视图不能有效果,在这个方法里面去设置。
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

7、允许手势传递在这个方法里面去设置。
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

你可能感兴趣的:(iOS,开发,开发语言)