【问题标题】:How to set the image for imageview from library wheen we click on imageview?当我们单击 imageview 时,如何从库中为 imageview 设置图像?
【发布时间】:2011-07-27 07:02:42
【问题描述】:

我正在开发一个应用程序。我想为 imageview 设置图像。所以当我点击 imageview 时,那时只有库会打开。为此我使用下面的方法。但是库将在每个地方的每一次点击。

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

但是我只想在点击imageview时打开图书馆。请告诉我如何解决这个问题。

【问题讨论】:

    标签: iphone


    【解决方案1】:

    设置myImageView.userInteractionEnabled = YES,然后使用UITapGestureRecognizer

    【讨论】:

      【解决方案2】:

      使用 Apple 官方文档中的 TapDetecingView。 TapDetectingView 然后创建一个子类 TapDetectingView 并仅包含您的图像视图的视图。最后,实现方法:

      • (void)tapDetectingView:(TapDetectingView *)view gotSingleTapAtPoint:(CGPoint)tapPoint;

      【讨论】:

        【解决方案3】:

        我认为这是不可能的 最好尝试其他选项......

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-05-27
          • 1970-01-01
          • 2013-06-19
          • 1970-01-01
          • 1970-01-01
          • 2023-04-10
          相关资源
          最近更新 更多