Re: NSView confusion
Re: NSView confusion
- Subject: Re: NSView confusion
- From: Graham Cox <email@hidden>
- Date: Tue, 19 Aug 2008 15:32:44 +1000
On 19 Aug 2008, at 9:02 am, Charlie Dickman wrote:
Also, how does one synchronize events with the update of the various
views? I can instruct each view what to draw and it draws it just
fine (I use lockFocus, etc. when drawing is external to drawRect)
and the updated view is seen _eventually_ but I can not synchronize
subsequent activity to happen after the appropriate display is seen.
How can I accomplish this synchronization? And how can I force a
view to update? Invoking [view display] has no effect on forcing the
display toshow the latest update.
In my experience it's rarely necessary to "force" a view to update.
Just mark it as needing update (-setNeedsDisplay:, -
setNeedsDisplayInRect:) and let it handle it in due course. It sounds
like you're trying to do its job for it, though hard to be sure from
your description. It's also not really clear why synchronisation is
needed, or what you're trying to accomplish. Again, the need to
"synchronise" views sets off alarm bells - rarely needed and maybe
indicative of the need to revise your design. If there is a data model
common to the views make it a separate object, apply changes there,
tell the views they need to update and voila! - all views show the new
state. Do not keep state/model data in a view unless your app is
trivial and it's the only view (and even then it's probably a bad idea).
hth,
cheers, 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