views:

936

answers:

3

The CA Programming Guide is talking about Constraints Layout Managers. However, the CALayer in the iPhone SDK doesn't have any constraints property or addConstraint method.

They say iPhone OS just doesnt provide custom layout managers. But how about the standard ones?

A: 

The only method you can use for positioning views/layers relative to their superview/superlayer is via the springs & struts model. Custom layout managers aren't available on the iPhone.

Nathan de Vries
that is, using autoresize masks?
Thanks
Yes -- for Core Animation that means using a mask as per the constants defined in CAAutoresizingMask.
Nathan de Vries
The documentation is actually wrong in this regard. autoresizingMask is not available as a property on CALayer on iPhone, so there is no way to even do the springs-and-struts layout of layers.
Brad Larson
+5  A: 

Unfortunately, despite the documentation saying so, even the springs-and-struts layout of layers is missing from the iPhone implementation of CALayer. This can be seen by the missing autoresizingMask property on CALayer on the iPhone.

For Core Plot, we implemented our own custom layer layout via the -layoutSublayers method of CALayer. The CPLayer class provides an example of this approach.

Brad Larson
Very interesting stuff, Brad!
Thanks
A: 

The Springs and Struts layout support is available via UIView's autoresizingMask property.

Frogblast