Re: drawing into a hidden view
Re: drawing into a hidden view
- Subject: Re: drawing into a hidden view
- From: Seth Willits <email@hidden>
- Date: Sun, 16 May 2010 11:55:17 -0700
On May 15, 2010, at 11:50 AM, Shane wrote:
> I have an application which swaps NSViews based on which segment of an
> NSSegmentedControl the user clicks on. There's one specific NSView in
> which I draw a graph using NSBezierPath's. This view is initialized
> once my application is started and always exists, it's just not always
> the currently selected view.
>
> My problem is that, when this one specific NSView is not selected and
> the user runs a process, once the process completes the user selects
> the view and no updates are drawn into it. But if the NSView is
> currently selected, the view gets updates when data points are sent to
> it. Selected or not, I always send data points to it to be drawn.
No you don't. You need them to be drawn when the view becomes visible. Drawing out-of-sight views is a waste of time and energy.
When a view is added to a window and will be visible, it is marked as needing to be display, and is drawn. So if by "swapping views" you mean it is added as a subview of another view made visible, and removed when not, then you should already be covered.
If by swapping you mean that you're simply switching selected tabs in a tab view and this graphing view is one of those tabs, then you're also taken care of. When a view's visible frame changes, it redraws.
So the only way I can think of that this is happening, is that your data set isn't being set, and the view is still drawing the old content. That or something is calling setNeedsDisplay:NO.
There's not really enough information here to go on.
--
Seth Willits
_______________________________________________
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