FROM : Uli Kusterer
DATE : Wed Aug 30 22:56:18 2006
Am 30.08.2006 um 20:40 schrieb Mike R. Manzano:
> (1) Is it prudent to add or remove subviews in drawRect:?
No. Moving views can cause a view to be invalidated, which would
cause drawRect: to be called again. If you search the list archives
you'll se epostings from lots of people who did it anyway and got
hilarious endless loops, dropped updates and other odd behaviour.
> If not,
>
> (2) Is it prudent to add or remove views somewhere else during a
> window live resize?
I think there's a notification sent when auto-resizing happens.
Alternatively, you could just override that method (don't remember
the name, but a quick read of NSView.h should make it obvious) that's
called when a superview is resized and asked to resize its subviews.
That should be a safe place to show/hide subviews before calling
through to super.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
DATE : Wed Aug 30 22:56:18 2006
Am 30.08.2006 um 20:40 schrieb Mike R. Manzano:
> (1) Is it prudent to add or remove subviews in drawRect:?
No. Moving views can cause a view to be invalidated, which would
cause drawRect: to be called again. If you search the list archives
you'll se epostings from lots of people who did it anyway and got
hilarious endless loops, dropped updates and other odd behaviour.
> If not,
>
> (2) Is it prudent to add or remove views somewhere else during a
> window live resize?
I think there's a notification sent when auto-resizing happens.
Alternatively, you could just override that method (don't remember
the name, but a quick read of NSView.h should make it obvious) that's
called when a superview is resized and asked to resize its subviews.
That should be a safe place to show/hide subviews before calling
through to super.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
| Related mails | Author | Date |
|---|---|---|
| Mike R. Manzano | Aug 30, 20:40 | |
| Uli Kusterer | Aug 30, 22:56 | |
| Andrew Merenbach | Aug 31, 06:58 | |
| Mike R. Manzano | Aug 31, 20:05 |






Cocoa mail archive

