UIKit Animation

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
  • backgroundColor
  • contentStretch – how content fills the available space

UIKit animation is block-based, i.e. animations are passed as blocks to its methods:

+animateWithDuration: animations:
+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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s