CALayer, CATextLayer, and inheritance . . .
CALayer, CATextLayer, and inheritance . . .
- Subject: CALayer, CATextLayer, and inheritance . . .
- From: "Michael A. Crawford" <email@hidden>
- Date: Sat, 10 Jan 2009 16:26:27 -0800
Ok, I think I'm hosed but I need one of you bright people to tell me
just how bad it is.
I'm working on a avionics simulation project that leverages Core
Animation and layers in order to composite various elements of the
display. These elements all have various behaviors and attributes
based on the information they are meant to convey to the person
reading them. For example, a compass displays directional information
using values ranging from 0 to 359. I decided to abstract away the
standard rotational transformation interface on a CALayer by creating
a sub-class that knows about the compass interface. This subclass
automatically converts degrees to radians, performs coordinate
transformations in order to get rotation to happen in the proper
direction, and sets up the associated animation, as well as handing
delegate callbacks.
At first it all seemed to work well, but when I created my first
derived CATextLayer class, I began to have strange issues. I won't
bore you with the details on that but here is the question: I'm
allocating and initializing my sub-classed layers using the alloc and
init methods:
@interface CompassLayer : CALayer . . .
@interface SpeedInfoLayer : CATextLayer . . .
CompassLayer* c = [[CompassLayer alloc] init];
SpeedInfoLayer* si = [[SpeedInfoLayer alloc] init];
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?
-Michael
----------------------
We know as much about software quality problems as they knew about the
Black Plague in the 1600s. We've seen the victims' agonies and helped
burn the corpses. We don't know what causes it; we don't really know
if there is only one disease. We just suffer - and keep pouring our
sewage into our water supply.
-- Unknown
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden