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)
})
All of the answers above are valid.
As a plus, with Swift I suggest to create an extension of UIView in order to "scale" any view you want.
You can take inspiration from this piece of code:
Usage is very simply:
Swift 3 Version
}
Scaling Button or any view about three times or more use following code. swift 3 or swift 4 with xcode 9.
Swift 3 Version:
iOS 9 and xCode 7
Here is a working example :
Swift 3.x+
Usage:
Credits: Sean Allen