Reputation: 41
I want to make a "Buy Now" button in my Application, which should work the same way as the one in the App Store, but I dont know how to resize the UIButton with an animation.
I have tried the following, but it resized the button at once and not as an animation:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:10.5];
[buyButton setFrame:CGRectMake(20, 115, 70, 21)];
[UIView commitAnimations];
Where the "buyButton" is a UIButton.
I've checked ou this post UIButton AppStore buy button animation, but is does not seem to work.
Upvotes: 4
Views: 907
Reputation: 11
Try this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:duration];
CGAffineTransform scale = CGAffineTransformMakeScale(scalingFactorX, scalingFactorY);
buyButton.transform = scale;
[UIView commitAnimations];
Using CGAffineTransform
may help. I have not tried this, however, it should work.
Upvotes: 1
Reputation: 3423
the sample code on theapptree.com for the inapp purchase should do what you want.
http://www.theapptree.com/samples
Upvotes: 0