怎么停止触发touchesEnded touchesMoved
langhua9527
由 langhua9527
发布于 2013年11月21日
无人欣赏。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; 当手指在屏幕上面滑动的时候,我想停止这样的事件,应该怎么处理
我说一个场景吧,比如说微信的发送声音的功能,你按下开始录音,然后等到60秒的时候,就自动停止,无论用户的手指是否还在屏幕上。。
共16条回复
楼长
·
tinyfool
回复于 2013年11月21日
你cancel不就是了么?
2楼
·
langhua9527
回复于 2013年11月21日
3楼
·
langhua9527
回复于 2013年11月21日
大家帮一下呀。。。。 我直接调touchesEnded 但是手指不松开的话。还会调touchesMoved
4楼
·
nickel
回复于 2013年11月21日
!!!!!!! 你脑子哪里去了?
toucheesMoved里响应到没关系,在toucheesMoved通过判断一个标志位或状态来决定是否做事就好了。
5楼
·
langhua9527
回复于 2013年11月21日
6楼
·
nickel
回复于 2013年11月22日
对你的思维很无语
7楼
·
adad184
回复于 2013年11月22日
view.userInteractionEnabled = NO;
view.userInteractionEnabled = YES;
试试
9楼
·
langhua9527
回复于 2013年11月22日
7楼 @adad184 好的,我试一下。。 @sycx你肿么看 @nickel大哥,你点播一下啥,我现在运到的问题是,如果用户手指放到屏幕不放,他会一直触发touchesMoved的,如果我直接调用touchesEnded,touchesMoved方法还是会执行,如果在touchesMoved加判断会使业务更加复杂。。我现在有足够的时间来处理的,我想用更好的方式来解决。。 我先试一下 view.userInteractionEnabled = NO; view.userInteractionEnabled = YES;
10楼
·
langhua9527
回复于 2013年11月22日
本帖有16个回复,因为您没有注册或者登录本站,所以只能看到本帖的10条回复。如果想看到全部回复,请注册或者登录本站。