Recently I had a chance to get “Learn iPad development and advanced iOS programming” from Equonix Learning Solutions and wanted to share what I have learned about UIKit animations.
UIKit offers several animation properties for UIViews, for more extensive animations it is better to use Core Animation.
Properties which can be animated using UIKit:
- frame – size and position
- bounds – size
- center – position
- transform – rotation relative to center point
- alpha – transparency
- contentStretch – how content fills the available space
UIKit animation is block-based, i.e. animations are passed as blocks to its methods:
+animateWithDuration: animations: completion:
+animateWithDuration: delay: options: animations: completion:
These are class methods on UIView, so they can be called on several views.
The options: parameter can control:
- the animation timing curve
- the number of repetitions
- whether the animation reverses
- whether views get touch events during animation
- whether animation should wait for any other animation to start
Completion: blocks can be used to chain animation together.