Core Animation for automatic grid-cell layout

Posted: February 12, 2009 in IT/Dev
Tags: , , , ,

At Mozketo blog, we can find a great trick about automatic grid cell layout in Objective-C, using Core Animation CAConstraint. This example defines the width constraint on the parent layer (superlayer) that contains the cells grid, and the constraint value is set as relative to the columns number. Then the grid’s cells width automatically adapts to the columns number if it changes, and doesn’t require any calculation to layout the cells in the grid bounds.
The example also adds random rotation and 3D transform to each cell (also through Core Animation).
The CAConstraint class isn’t yet available in Cappuccino however.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s