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

      <bdo id='Dsjli'></bdo><ul id='Dsjli'></ul>
    1. <tfoot id='Dsjli'></tfoot>
    2. <small id='Dsjli'></small><noframes id='Dsjli'>

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

      1. UIButton 删除所有目标动作

        时间:2023-07-09
        <legend id='fxN9Q'><style id='fxN9Q'><dir id='fxN9Q'><q id='fxN9Q'></q></dir></style></legend>

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

              <bdo id='fxN9Q'></bdo><ul id='fxN9Q'></ul>
              1. <small id='fxN9Q'></small><noframes id='fxN9Q'>

                    <tbody id='fxN9Q'></tbody>
                  <tfoot id='fxN9Q'></tfoot>
                • 本文介绍了UIButton 删除所有目标动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已将多个 target-action-forControlEvents: 添加到 UIButton.我想一次性删除所有这些而不释放任何东西.然后我会设定新的目标.

                  I have added multiple target-action-forControlEvents: to a UIButton. I'd like to remove all of these in one go without deallocating anything. I will then set new targets.

                  这可能吗?我该怎么做?

                  Is this possible and how do I go about it?

                  推荐答案

                  调用removeTarget:action:forControlEvents:,为目标传递 nil,为操作传递 NULL,并使用设置所有位的控制掩码 (UIControlEventAllEvents).

                  Call removeTarget:action:forControlEvents:, pass nil for the target, NULL for action, and use a control mask that sets all bits (UIControlEventAllEvents).

                  Objective-C

                  [someControl removeTarget:nil 
                                     action:NULL 
                           forControlEvents:UIControlEventAllEvents];
                  

                  斯威夫特 2

                  button.removeTarget(nil, action: nil, forControlEvents: .AllEvents)
                  

                  Swift 3 或更高版本

                  button.removeTarget(nil, action: nil, for: .allEvents)
                  

                  这篇关于UIButton 删除所有目标动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iOS 15 中的 UIButton 图像行为发生了变化? 下一篇:iPhone UIButton - 图像位置

                  相关文章

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

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

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

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