@IBOutlet weak var dialogView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
//Animation Effect
dialogView.transform = CGAffineTransformMakeScale(0.0, 0.0)
//For a Translation Animation use instead:
// dialogView.transform = CGAffineTransformMakeTranslation(0, 500)
}
override func viewDidAppear(animated: Bool) {
//Spring Animation
//Damping must be between 1 and 0
UIView.animateWithDuration(0.7, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.5, options: nil, animations: {
self.dialogView.transform = CGAffineTransformMakeScale(1, 1)
}, completion: nil)
}
How to create a transform animation to a UIView using Spring Animations with Swift
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.