Re: UI elements in custom view mess up drawing
Re: UI elements in custom view mess up drawing
- Subject: Re: UI elements in custom view mess up drawing
- From: Graham Cox <email@hidden>
- Date: Wed, 15 Oct 2008 00:44:17 +1100
On 15 Oct 2008, at 12:38 am, Antonio Nunes wrote:
As you can see from the image it looks like the view first draws
itself correctly, then gets drawn for each of the other subviews,
with its origin offset to match the origin of the subview in
question. I don't understand why this happens.
You've made the classic error of assuming that 'rect' passed to
drawRect: is your view's bounds. It's not. It's the area requiring
update.
Replace all references to 'rect' with [self bounds] and all will be
well. This must crop up at least once or twice a month.
hth,
Graham
_______________________________________________
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