On 10-Jan-09, at 7:26 PM, Michael A. Crawford wrote:

I know that the documentation states the CALayer entities are to be allocated with class methods:

CALayer* l = [CALayer layer];
CATextLayer* tl = [CATextLayer layer];

Am I creating a problem by not allocating and initializing my layers using the class methods?

No. it is perfectly valid to do that. init is the designated initializer for CALayer. +layer is simply a convenience. The header shows this, although the doc didn't (until just now -- so next push it will show the below)

what you are not supposed to do is use initWithLayer:, that's a special method only used when you create custom presentation layers for a model layer (i.e. very, very rarely) (see the doc for more information).

init
Returns an initialized CALayer object.

- (id)init

Return Value
An initialized CALayer object.

Discussion
This is the designated initializer for CALayer.

See Also
        • + layer
Declared InCALayer.h_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to