【问题标题】:how to implement two fingers panning like safari broswer?如何实现像 safari 浏览器一样的两根手指画?
【发布时间】:2011-03-16 09:58:43
【问题描述】:

我尝试在 ipad 中实现平移和缩放功能,例如 safari 浏览器。

我使用 UIPinchGestureRecognizer 通过两根手指触摸进行缩放。但我不知道如何实现两个手指平移。

当我用两根手指触摸时,它的点击次数为 1。

请帮忙。

提前致谢。

【问题讨论】:

    标签: iphone iphone-sdk-3.2 panning


    【解决方案1】:

    您不想要 tapCount,您想要触摸次数。如果您用两根手指触摸,则可以进行两次触摸事件,每次点击次数为 1。

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    

    [touches count] 将返回 2,每个指尖一个。

    Read through the apple guide for touch events

    【讨论】:

    • 对于单指触摸,我必须执行其他操作,如果用户用两根手指触摸,我必须平移视图
    • 能否详细描述一下
    • 你了解tapCount和触摸次数的区别吗?
    • - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint thePoint; NSLog(@"%d",[触摸次数]); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint thePoint; NSLog(@"%d",[触摸次数]); } 但两种方法都记录 1 个计数
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    • 2018-02-28
    • 1970-01-01
    • 1970-01-01
    • 2017-06-19
    相关资源
    最近更新 更多