<bdo id='MBKyY'></bdo><ul id='MBKyY'></ul>

      <i id='MBKyY'><tr id='MBKyY'><dt id='MBKyY'><q id='MBKyY'><span id='MBKyY'><b id='MBKyY'><form id='MBKyY'><ins id='MBKyY'></ins><ul id='MBKyY'></ul><sub id='MBKyY'></sub></form><legend id='MBKyY'></legend><bdo id='MBKyY'><pre id='MBKyY'><center id='MBKyY'></center></pre></bdo></b><th id='MBKyY'></th></span></q></dt></tr></i><div id='MBKyY'><tfoot id='MBKyY'></tfoot><dl id='MBKyY'><fieldset id='MBKyY'></fieldset></dl></div>
    1. <small id='MBKyY'></small><noframes id='MBKyY'>

    2. <tfoot id='MBKyY'></tfoot>

    3. <legend id='MBKyY'><style id='MBKyY'><dir id='MBKyY'><q id='MBKyY'></q></dir></style></legend>
    4. 哪个更好,setEnabled 或 setUserInteractionEnabled?

      时间:2023-07-08

            <tbody id='T1PbH'></tbody>

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

          • <small id='T1PbH'></small><noframes id='T1PbH'>

            <legend id='T1PbH'><style id='T1PbH'><dir id='T1PbH'><q id='T1PbH'></q></dir></style></legend>

                <i id='T1PbH'><tr id='T1PbH'><dt id='T1PbH'><q id='T1PbH'><span id='T1PbH'><b id='T1PbH'><form id='T1PbH'><ins id='T1PbH'></ins><ul id='T1PbH'></ul><sub id='T1PbH'></sub></form><legend id='T1PbH'></legend><bdo id='T1PbH'><pre id='T1PbH'><center id='T1PbH'></center></pre></bdo></b><th id='T1PbH'></th></span></q></dt></tr></i><div id='T1PbH'><tfoot id='T1PbH'></tfoot><dl id='T1PbH'><fieldset id='T1PbH'></fieldset></dl></div>
                本文介绍了哪个更好,setEnabled 或 setUserInteractionEnabled?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想为用户触摸禁用 UIButton.setEnabledsetUserInteractionEnabled 都可以做到这一点.哪个更好?它们有何不同?

                I want to make a UIButton disable for user touch. Both setEnabled and setUserInteractionEnabled can do this. Which is better? How are they different?

                推荐答案

                enabledUIControl的一个属性,UIControlUIButton.userInteractionEnabledUIView 的一个属性(它是 UIControl 的超类).enabled 对对象的视觉状态有影响(默认为灰色),通常是禁用控件的首选方法——指示行为的视觉反馈是一件好事.

                enabled is a property of UIControl, which is the superclass for UIButton. userInteractionEnabled is a property of UIView (which is the superclass of UIControl). enabled has effects on the visual state of the object (grayed out, by default) and is generally the preferred method of disabling a control—visual feedback indicating behaviors is a good thing.

                除此之外,没有太多实际的结果.与控件交互的代码更有可能检查按钮是否已启用,而不是它们的 userInteractionEnabled 属性是否已设置.因此,使用 enabled 更为传统.

                There's not much practical upshot beyond that. Code that interacts with your controls is more likely to check if buttons are enabled than if their userInteractionEnabled property is set. Hence using enabled is more conventional.

                这篇关于哪个更好,setEnabled 或 setUserInteractionEnabled?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    <bdo id='WIMrX'></bdo><ul id='WIMrX'></ul>

                    • <small id='WIMrX'></small><noframes id='WIMrX'>

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