<small id='MVHxC'></small><noframes id='MVHxC'>

      <bdo id='MVHxC'></bdo><ul id='MVHxC'></ul>
    <tfoot id='MVHxC'></tfoot>

      <i id='MVHxC'><tr id='MVHxC'><dt id='MVHxC'><q id='MVHxC'><span id='MVHxC'><b id='MVHxC'><form id='MVHxC'><ins id='MVHxC'></ins><ul id='MVHxC'></ul><sub id='MVHxC'></sub></form><legend id='MVHxC'></legend><bdo id='MVHxC'><pre id='MVHxC'><center id='MVHxC'></center></pre></bdo></b><th id='MVHxC'></th></span></q></dt></tr></i><div id='MVHxC'><tfoot id='MVHxC'></tfoot><dl id='MVHxC'><fieldset id='MVHxC'></fieldset></dl></div>
    1. <legend id='MVHxC'><style id='MVHxC'><dir id='MVHxC'><q id='MVHxC'></q></dir></style></legend>
      1. UIImageView 上的用户交互

        User Interaction on a UIImageView(UIImageView 上的用户交互)
          <legend id='S30ka'><style id='S30ka'><dir id='S30ka'><q id='S30ka'></q></dir></style></legend>

            <small id='S30ka'></small><noframes id='S30ka'>

            • <bdo id='S30ka'></bdo><ul id='S30ka'></ul>

            • <i id='S30ka'><tr id='S30ka'><dt id='S30ka'><q id='S30ka'><span id='S30ka'><b id='S30ka'><form id='S30ka'><ins id='S30ka'></ins><ul id='S30ka'></ul><sub id='S30ka'></sub></form><legend id='S30ka'></legend><bdo id='S30ka'><pre id='S30ka'><center id='S30ka'></center></pre></bdo></b><th id='S30ka'></th></span></q></dt></tr></i><div id='S30ka'><tfoot id='S30ka'></tfoot><dl id='S30ka'><fieldset id='S30ka'></fieldset></dl></div>

                    <tbody id='S30ka'></tbody>
                  <tfoot id='S30ka'></tfoot>
                  本文介绍了UIImageView 上的用户交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有许多 UIImageView,上面有按钮.

                  I have a number of UIImageView which have buttons on top of them.

                  我想在这些按钮后面的 UIImageView 上启用用户交互.

                  I would like to enable user interaction on the UIImageView behind these buttons.

                  我在 IB 中看到了该选项,但想知道在实际触摸 UIImageView 时如何触发一些代码.

                  I see the option in IB, but would like to know how to trigger some code when the UIImageView is actually touched.

                  如何做到这一点以及如何在代码而不是 IB 中将其设置为启用和禁用?

                  How does one do this and how is it set to enabled and disabled in the code rather than IB?

                  谢谢

                  推荐答案

                  当 UIImageView 实际被触摸时如何触发一些代码.

                  how to trigger some code when the UIImageView is actually touched.

                  你有两个选择:

                  1. 创建 UITapGestureRecognizer(或其他手势识别器)的实例,指定目标和操作方法.然后使用 -[UIView addGestureRecognizer:] 将手势识别器添加到图像视图中.适用于 OS 3.2+.

                  1. Create an instance of UITapGestureRecognizer (or another gesture recognizer), specifying a target and an action method. Then add the gesture recognizer to the image view with -[UIView addGestureRecognizer:]. Works in OS 3.2+.

                  子类 UIImageView 并覆盖 -touches... 方法.确保您创建的图像视图是您的自定义子类的实例.

                  Subclass UIImageView and override the -touches... methods. Make sure the image views you create are instances of your custom subclass.

                  有关详细信息,请参阅文档.

                  See the documentation for details.

                  如何在代码而不是IB中设置为启用和禁用

                  how is it set to enabled and disabled in the code rather than IB

                  简单:imageView.userInteractionEnabled = YES;

                  这篇关于UIImageView 上的用户交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                  When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                  Selecting text in mobile Safari on iPhone(在 iPhone 上的移动 Safari 中选择文本)
                  Create UIImage cutout(创建 UIImage 抠图)
                  Draggable UIImageView Partially Transparent amp; Irregular Shaped(可拖动的 UIImageView 部分透明 amp;不规则形状)
                  How to set the resolution of a saved image from the UIImagePickerController(如何从 UIImagePickerController 设置保存图像的分辨率)
                    <legend id='C4aaH'><style id='C4aaH'><dir id='C4aaH'><q id='C4aaH'></q></dir></style></legend>

                      <small id='C4aaH'></small><noframes id='C4aaH'>

                            <bdo id='C4aaH'></bdo><ul id='C4aaH'></ul>
                            <tfoot id='C4aaH'></tfoot>
                            <i id='C4aaH'><tr id='C4aaH'><dt id='C4aaH'><q id='C4aaH'><span id='C4aaH'><b id='C4aaH'><form id='C4aaH'><ins id='C4aaH'></ins><ul id='C4aaH'></ul><sub id='C4aaH'></sub></form><legend id='C4aaH'></legend><bdo id='C4aaH'><pre id='C4aaH'><center id='C4aaH'></center></pre></bdo></b><th id='C4aaH'></th></span></q></dt></tr></i><div id='C4aaH'><tfoot id='C4aaH'></tfoot><dl id='C4aaH'><fieldset id='C4aaH'></fieldset></dl></div>
                              <tbody id='C4aaH'></tbody>