目标C:停止触摸滚动 [英] Objective C: Stop Scrolling on Touch

查看:44
本文介绍了目标C:停止触摸滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户开始触摸屏幕并移动时,我试图暂时停止视图的滚动.

I am trying to temporarily stop the scrolling of my view when the user starts to touch the screen and move.

我已经对此进行了编码

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    if (touch){
        [scrollView setScrollEnabled:FALSE];
    }
}

它不起作用.

推荐答案

尝试一下:

    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
           [scrollView setScrollEnabled:FALSE];
    }

现在我只是想知道您在哪里再次启用它...

now i just wonder where you enable it again...

这篇关于目标C:停止触摸滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆