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

  • <tfoot id='sE7ca'></tfoot>
    <legend id='sE7ca'><style id='sE7ca'><dir id='sE7ca'><q id='sE7ca'></q></dir></style></legend>

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

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

        防止 UIButton 的 setTitle:forState: 动画

        时间:2023-07-07
            <bdo id='4b0by'></bdo><ul id='4b0by'></ul>

                  <tbody id='4b0by'></tbody>

                  <small id='4b0by'></small><noframes id='4b0by'>

                • <tfoot id='4b0by'></tfoot>
                • <i id='4b0by'><tr id='4b0by'><dt id='4b0by'><q id='4b0by'><span id='4b0by'><b id='4b0by'><form id='4b0by'><ins id='4b0by'></ins><ul id='4b0by'></ul><sub id='4b0by'></sub></form><legend id='4b0by'></legend><bdo id='4b0by'><pre id='4b0by'><center id='4b0by'></center></pre></bdo></b><th id='4b0by'></th></span></q></dt></tr></i><div id='4b0by'><tfoot id='4b0by'></tfoot><dl id='4b0by'><fieldset id='4b0by'></fieldset></dl></div>
                  <legend id='4b0by'><style id='4b0by'><dir id='4b0by'><q id='4b0by'></q></dir></style></legend>
                  本文介绍了防止 UIButton 的 setTitle:forState: 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 NSTimer 每秒更新 UIButton 的标题.

                  I am using a NSTimer to update a UIButton's title every second.

                  它可以工作,但标题中的文本会自动闪烁(动画为 alpha 0 并返回).

                  It works but the text in the title blinks (animates to alpha 0 and back) automatically.

                  我尝试使用 button.layer.removeAllAnimations() 没有运气,也没有例外,所以 QuartzCore 似乎正确链接.

                  I tried to use button.layer.removeAllAnimations() with no luck, and no exceptions, so QuartzCore seems to be correctly linked.

                  当前无效的偏执代码:

                  UIView.setAnimationsEnabled(false)
                  UIView.performWithoutAnimation {
                      button.setTitle(time, forState: .Normal)
                      button.layer.removeAllAnimations()
                          }
                  UIView.setAnimationsEnabled(true)
                  

                  推荐答案

                  确保您的按钮是自定义"按钮而不是系统"按钮.

                  Make sure your button is a "custom" button and not a "system" button.

                  如果您在情节提要上创建它,则只需更改按钮类型.如果您以编程方式创建它,那么它应该是:

                  If you created it on a storyboard, then just change the Button Type. If you created it programmatically, then it should be:

                  UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  

                  这篇关于防止 UIButton 的 setTitle:forState: 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UIButton 不会变灰 下一篇:如何取回 iOS 7 中的 UIButton 边框?

                  相关文章

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

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

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

                    1. <tfoot id='ghYv2'></tfoot>