Re: Basic, but still confuses me (initWithFrame and drawRect)
Re: Basic, but still confuses me (initWithFrame and drawRect)
- Subject: Re: Basic, but still confuses me (initWithFrame and drawRect)
- From: David Duncan <email@hidden>
- Date: Fri, 19 Jun 2009 09:56:02 -0700
On Jun 19, 2009, at 9:26 AM, Chunk 1978 wrote:
i don't understand the difference between the 2. i think i'm suppose
to simply set the frame size in initWithFrame method, and set
attributes (like background color, and clipping masks, etc.) in the
drawRect method.
-initWithFrame: is one of the designated initailizers for a UIView
(the other is -initWithCoder: for loading from a NIB). When -
initWithFrame: completes, the view needs to be initialized to the
point that it can do something useful.
-drawRect: is just for drawing. You should be doing as little as
possible inside of -drawRect: and it should all be 100% related to
drawing the content of your view. You may read from various
properties, but you almost never set them.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
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