Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scale UIButton Animation- Swift [closed]

I'm trying to do scale animation for UIButton when its clicked but what I'm trying to accomplish is when the button clicked I need the UIButton to be smaller to the inside then it comes back to its same size (like a bubble).

I tried the following:

button.transform = CGAffineTransformMakeScale(-1, 1)  UIView.animateWithDuration(0.5, animations: { () -> Void in      button.transform = CGAffineTransformMakeScale(1,1)  }) 
like image 490
AaoIi Avatar asked Jul 09 '15 14:07

AaoIi


1 Answers

Try this

UIView.animate(withDuration: 0.6,     animations: {         self.button.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)     },     completion: { _ in         UIView.animate(withDuration: 0.6) {             self.button.transform = CGAffineTransform.identity         }     }) 
like image 63
nRewik Avatar answered Oct 04 '22 19:10

nRewik