Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you making your changes inside the Core Animation block?</p> <p>I created a simple view-based iPhone application to test this. The view has two rounded rect UIButton objects:</p> <ol> <li><p>The first button is in the upper right corner with width 62 (and height 35) and initial title "$0.99". It is connected to the "button" outlet and "animate" action in the view controller. This is the button that will be animated when it is tapped.</p></li> <li><p>The second button is at the bottom of the screen with title "Reset" and is connected to the "reset" action in my view controller.</p></li> </ol> <p>Here is the view controller code:</p> <p><strong>UIButtonAnimationTestViewController.h:</strong></p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface UIButtonAnimationTestViewController : UIViewController { IBOutlet UIButton *button; CGRect originalFrame; } - (IBAction)animate; - (IBAction)reset; @end </code></pre> <p><strong>UIButtonAnimationTestViewController.m:</strong></p> <pre><code>#import "UIButtonAnimationTestViewController.h" @implementation UIButtonAnimationTestViewController - (void)viewDidLoad { [super viewDidLoad]; originalFrame = button.frame; } - (IBAction)animate { CGRect frame = button.frame; frame.origin.x -= 30; frame.size.width += 30; [UIView beginAnimations:@"button" context:nil]; button.frame = frame; [button setTitle:@"" forState:UIControlStateNormal]; [UIView setAnimationDelegate:self]; [UIView commitAnimations]; } - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [button setTitle:@"BUY NOW" forState:UIControlStateNormal]; } - (IBAction)reset { button.frame = originalFrame; [button setTitle:@"$0.99" forState:UIControlStateNormal]; } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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