UIButton Buy Now Effect

I want to make a Buy Now button in my application, which should work just like in the App Store, but I don’t know how to resize UIButton using animation.

I tried the following, but it resized the button at the same time, and not as an animation:

[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:10.5]; [buyButton setFrame:CGRectMake(20, 115, 70, 21)]; [UIView commitAnimations]; 

Where "buyButton" is UIButton.

I checked this post with the UIButton AppStore purchase button animation , but it doesn't seem to work.

+4
source share
2 answers

Try the following:

 [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:duration]; CGAffineTransform scale = CGAffineTransformMakeScale(scalingFactorX, scalingFactorY); buyButton.transform = scale; [UIView commitAnimations]; 

Using CGAffineTransform can help. I have not tried this, however, it should work.

+1
source

the sample code on theapptree.com for inapp purchase should do what you want.

http://www.theapptree.com/samples

0
source

Source: https://habr.com/ru/post/1301731/


All Articles