Note that there are some explanatory texts on larger screens.

plurals
  1. PORotating UIButton
    primarykey
    data
    text
    <p>I've been trying to rotate a button using the following method:</p> <pre><code>-(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)]; }]; } </code></pre> <p>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 <em>at all</em>.</p> <p>What's the problem with my code?</p> <p>Thanks!</p> <p>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.</p> <p>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.</p> <pre><code>[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){ } ]; </code></pre> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload