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

      <legend id='XEY3W'><style id='XEY3W'><dir id='XEY3W'><q id='XEY3W'></q></dir></style></legend>
    1. <tfoot id='XEY3W'></tfoot>

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

      旋转 UIButton 360 度

      时间:2023-07-30
            <legend id='BYbYV'><style id='BYbYV'><dir id='BYbYV'><q id='BYbYV'></q></dir></style></legend>
          1. <i id='BYbYV'><tr id='BYbYV'><dt id='BYbYV'><q id='BYbYV'><span id='BYbYV'><b id='BYbYV'><form id='BYbYV'><ins id='BYbYV'></ins><ul id='BYbYV'></ul><sub id='BYbYV'></sub></form><legend id='BYbYV'></legend><bdo id='BYbYV'><pre id='BYbYV'><center id='BYbYV'></center></pre></bdo></b><th id='BYbYV'></th></span></q></dt></tr></i><div id='BYbYV'><tfoot id='BYbYV'></tfoot><dl id='BYbYV'><fieldset id='BYbYV'></fieldset></dl></div>
              <bdo id='BYbYV'></bdo><ul id='BYbYV'></ul>
            • <small id='BYbYV'></small><noframes id='BYbYV'>

                <tbody id='BYbYV'></tbody>

              <tfoot id='BYbYV'></tfoot>
                本文介绍了旋转 UIButton 360 度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我一直在尝试使用以下代码运行将我的 UIButton 旋转 360 度的动画:

                I've been trying to run an animation that rotates my UIButton 360 degrees using this code:

                UIView.animateWithDuration(3.0, animations: {
                  self.vineTimeCapButton.transform = CGAffineTransformMakeRotation(CGFloat(M_PI*2))
                  self.instagramTimeCapButton.transform = CGAffineTransformMakeRotation(CGFloat(M_PI*2))
                })
                

                但是,它不会旋转 360 度,因为 UIButton 已经在那个位置.

                However, it doesn't rotate 360 degrees because the UIButton is already at that location.

                如何将我的 UIButton 旋转 360 度?

                How can I rotate my UIButton 360 degrees?

                推荐答案

                可以使用一个技巧:先旋转180度,再旋转360度.使用 2 个延迟动画.试试这个.

                You can use a trick: start rotating with 180 degrees first and then rotate with 360 degrees. Use 2 animations with delay. Try this.

                斯威夫特 2

                UIView.animateWithDuration(0.5) { () -> Void in
                  button.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
                }
                
                UIView.animateWithDuration(0.5, delay: 0.45, options: UIViewAnimationOptions.CurveEaseIn, animations: { () -> Void in      
                  button.transform = CGAffineTransformMakeRotation(CGFloat(M_PI * 2))
                }, completion: nil)
                

                斯威夫特 3、4、5

                UIView.animate(withDuration: 0.5) { () -> Void in
                  self.settingsButton.transform = CGAffineTransform(rotationAngle: CGFloat.pi)
                }
                
                UIView.animate(withDuration: 0.5, delay: 0.45, options: UIViewAnimationOptions.curveEaseIn, animations: { () -> Void in
                  self.settingsButton.transform = CGAffineTransform(rotationAngle: CGFloat.pi * 2.0)
                }, completion: nil)
                

                希望对你有帮助

                这篇关于旋转 UIButton 360 度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 UIImageRenderingModeAlwaysTemplate 从界面生成器中为 UIButton 的图像着 下一篇:如果将 UIView 添加为子视图,则 UIButton 目标不起作用

                相关文章

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

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

                  1. <tfoot id='gjRbi'></tfoot>
                    • <bdo id='gjRbi'></bdo><ul id='gjRbi'></ul>