【问题标题】:Sliding finger UIImageView滑动手指 UIImageView
【发布时间】:2010-03-27 04:44:20
【问题描述】:

如何检测手指滑过 UIImageView 的时间?例如,假设您将手指滑过它,它会改变颜色或其他东西。我希望能够滑过多个 UIImageViews 并发生一些事情......

【问题讨论】:

    标签: iphone sdk uiimageview touch swipe


    【解决方案1】:

    UIScrollView 中尝试UIImageView

    要在UIImageView 中检测您的触摸,您必须重写UIImageView 并将UserInteractionEnabled 设置为YES。然后你可以处理像touchesBegantouchesEnded这样的事件。

    UIImageWithTouchControl.h

    @interface UIImageWithTouchControl : UIImageView
    

    UIImageWithTouchControl.m

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多