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

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

      1. <small id='tjFBx'></small><noframes id='tjFBx'>

          <bdo id='tjFBx'></bdo><ul id='tjFBx'></ul>
      2. 旋转 UIButton

        Rotating UIButton(旋转 UIButton)
              <bdo id='79ggo'></bdo><ul id='79ggo'></ul>

                <tfoot id='79ggo'></tfoot>
                  <tbody id='79ggo'></tbody>

                <legend id='79ggo'><style id='79ggo'><dir id='79ggo'><q id='79ggo'></q></dir></style></legend>

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

                  <small id='79ggo'></small><noframes id='79ggo'>

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

                  问题描述

                  我一直在尝试使用以下方法旋转按钮:

                  I've been trying to rotate a button using the following method:

                  -(IBAction)rotate:(id)sender{
                      CGPoint pencilCenter = pencil.center;
                      [pencil setCenter:pencilCenter];
                      CGFloat floater = 1.0;
                      [UIView animateWithDuration:0.7 animations:^(void){
                          [pencil setTransform:CGAffineTransformMakeRotation(floater)];
                      }];
                      [UIView animateWithDuration:0.7 animations:^(void){
                          [pencil setTransform:CGAffineTransformMakeRotation(floater)];
                      }];
                  }
                  

                  这应该使按钮进行某种摇动",然后它应该回到原来的位置 - 但它所做的只是改变按钮的位置,将其仅移动到一侧并在另一次运行按钮没有反应的方法根本.

                  This is supposed to make the button do some kind of "shake", then it's supposed to be back in its original position- yet all it does is changing the button's location, moving it to only one side and on another run of the method the button doesn't react at all.

                  我的代码有什么问题?

                  谢谢!

                  编辑 2:我的问题是 - 我如何制作一个按钮来做一点摇晃/摆动,例如编辑 sptingboard 时的 Wiggle 应用模式.

                  EDIT 2: My que is- how do I make a button to do a little shake/wiggle ,e.g. the wiggle app mode when editing sptingboard.

                  使用此代码让我向左旋转,从左到右然后从右到左平滑动画,然后旋转到原始位置.现在,我希望它不仅仅是旋转,而是通过动画来实现,比如摆动.

                  Using this code is giving me rotation to left, smooth animates from left to right then right to left, then rotates to original position. Now, I want this not to just rotate, but do this with an animation, like a wiggle.

                  [UIView animateWithDuration:0.25
                                        delay:0.0
                                      options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveLinear | UIViewAnimationOptionAutoreverse)
                                   animations:^ {
                                       pencil.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(30));
                                       pencil.transform = CGAffineTransformIdentity;
                                   }
                                   completion:^(BOOL finished){
                                   }
                   ];
                  

                  谢谢!

                  推荐答案

                  导入QuartzCore/QuartzCore.h"试试这个,

                  Import "QuartzCore/QuartzCore.h" and try this,

                  CABasicAnimation *fullRotation;
                  fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
                  fullRotation.delegate = self;
                  fullRotation.fromValue = [NSNumber numberWithFloat:0];
                  fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
                  fullRotation.duration = 1.7;
                  fullRotation.repeatCount = 2;
                  [btnTemp.layer addAnimation:fullRotation forKey:@"360"];
                  

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UIButton title text color(UIButton 标题文本颜色)
                  Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                  Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                  How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                  iPhone UIButton - image position(iPhone UIButton - 图像位置)
                  UIButton remove all target-actions(UIButton 删除所有目标动作)
                • <legend id='rDAA4'><style id='rDAA4'><dir id='rDAA4'><q id='rDAA4'></q></dir></style></legend>

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

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

                            <tfoot id='rDAA4'></tfoot>