Updated 18 December 2016
Suppose you want to apply the animation on image that will zoom in and zoom out on tap on the image. You want to show animation tapping the image, You have to use the CGAffineTransform to show the animation on image. If you will set its value 1 then it will pick original size ,If it is less than <1 the image compress according to size , If it is greater than >1 then it will increase the size of the image , If you will set the 2.0 size , then it will show the double size as the original image,If you will set the 0.0 size it will hide the image . You can also set the animation time. Example :-
1 2 3 4 5 6 7 8 9 10 |
if let temp : UIImageView = self.view.viewWithTag((recognizer.view?.tag)!) as? UIImageView{ temp.image = UIImage(named: "ic_wishlist_fill") UIView.animate(withDuration: 0.5, animations: {() -> Void in temp.transform = CGAffineTransform(scaleX: 1.5, y: 1.5) }, completion: {(_ finished: Bool) -> Void in UIView.animate(withDuration: 0.5, animations: {() -> Void in temp.transform = CGAffineTransform(scaleX: 1, y: 1) }) }) |
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.