• <tfoot id='auOqk'></tfoot>

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

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

        <legend id='auOqk'><style id='auOqk'><dir id='auOqk'><q id='auOqk'></q></dir></style></legend>
      1. <small id='auOqk'></small><noframes id='auOqk'>

      2. UIButtons 在动画期间没有响应 - iOS Swift 3

        时间:2023-07-06

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

              <tfoot id='oNy6C'></tfoot>
                • <small id='oNy6C'></small><noframes id='oNy6C'>

                  本文介绍了UIButtons 在动画期间没有响应 - iOS Swift 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在构建一个计算器应用程序,当我点击按钮时会出现一个简短的动画.问题是按钮在动画时没有响应,这让应用感觉迟钝.

                  I'm building a calculator app, when I tap on the buttons there is a short animation. The problem is the buttons do not respond while they are animating, which makes the app feel laggy.

                  我找到了一些针对 Objective-C 的解决方案:

                  I found some solutions for Objective-C using:

                  UIViewAnimationOptionAllowUserInteraction
                  

                  但 Swift 3 没有,我的代码如下所示:

                  but nothing for Swift 3, my code looks like this:

                  func myButton () {
                  
                      sender.layer.backgroundColor = firstColor
                      sender.setTitleColor(UIColor.white, for: UIControlState.normal)
                  
                      UIView.animate(withDuration: 0.5) {
                          sender.layer.backgroundColor = secondColor
                      }
                  }
                  

                  推荐答案

                  调用UIView的不同方法:

                  Call different method of UIView:

                  func myButton () {
                      sender.layer.backgroundColor = firstColor
                      sender.setTitleColor(UIColor.white, for: UIControlState.normal)
                  
                      UIView.animate(withDuration: 0.5,
                                     delay: 0.0,
                                     options: .allowUserInteraction,
                                     animations: {
                                         sender.layer.backgroundColor = secondColor },  
                                     completion: nil)
                  }
                  

                  这篇关于UIButtons 在动画期间没有响应 - iOS Swift 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从另一个类修改 UIButton 的 alpha 属性 下一篇:用于实例化 ViewController 的按钮在隐藏后不起作用

                  相关文章

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

                • <legend id='t7ay7'><style id='t7ay7'><dir id='t7ay7'><q id='t7ay7'></q></dir></style></legend>

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

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