Re: Weird behavior when adding subview
Re: Weird behavior when adding subview
- Subject: Re: Weird behavior when adding subview
- From: August Trometer <email@hidden>
- Date: Thu, 20 Apr 2006 19:04:33 -0400
You probably shouldn't be adding subviews in drawRect: because it
gets called quite frequently. In your case, every time drawRect: gets
called, another NSTextField gets added. What you're seeing is many of
your NSTextFields, all drawn over the top of each other. Your custom
view then has multiple subviews, only one of which you really intend.
I'd find a different place to add the subview.
-- August
On Apr 20, 2006, at 6:25 PM, Eamon Ford wrote:
I have a custom view in which I programmatically create an
NSTextField and add it as a subview, in the drawRect: method. But
whenever the view is redrawn (i.e. I resize the window, etc.), it
seems to redraw the text field over itself. Sorry, I couldn't think
of a better explanation, but here's a screenshot of what's
happening: <http://homepage.mac.com/eamonford/screenshot.png>
I'm sure there's a simple solution, but I'm not very experienced.
What would be the best way to fix this?
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden