【问题标题】:How do I make my UIImageview respond to a swipe gesture如何让我的 UIImageview 响应滑动手势
【发布时间】:2011-03-05 20:21:54
【问题描述】:

例如换入另一个 UIImage 等。

【问题讨论】:

    标签: iphone-sdk-3.0 uiimageview swipe


    【解决方案1】:

    UIImageView 是 UIView 的子类。您可以使用 addGestureRecognizer: 将手势识别器添加到任何视图。

    【讨论】:

    • 请注意这是标记为 [iphone-sdk-3.0],直到 3.2 才添加手势识别器。
    • 好消息@Anomie - 我应该更仔细地阅读标签:)
    【解决方案2】:

    我看到你标记了这个 [iphone-sdk-3.0]。如果您可以使用 SDK 3.2 或更高版本,则可以使用 UISwipeGestureRecognizer 轻松完成。如果必须坚持使用 3.0,则必须继承 UIImageView 并处理 touchesBegan:withEvent:touchesMoved:withEvent:touchesEnded:withEvent: 和/或 touchesCancelled:withEvent:

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多