Re: Changing subviews during drawing
Re: Changing subviews during drawing
- Subject: Re: Changing subviews during drawing
- From: j o a r <email@hidden>
- Date: Tue, 30 Mar 2004 20:22:40 +0200
I assume that the attributes of the plot doesn't change *during*
drawRect, so why is this a problem? When the attribues change,
presumably from some user action, do what you have to do with the
subviews, and then call "setNeedsDisplay:" (or if you really, really,
really, have to; "display"). Something like this:
- (void) changeAttributeToSomePhoneyValue:(int) theNewValue
{
theValue = theNewValue;
[self setSubviewsBasedOnNewValue];
[myView setNeedsDisplay: YES];
}
j o a r
On 2004-03-30, at 19.56, Drew McCormack wrote:
>
Can you safely change the subview of an NSView in its drawRect:
>
method? I have been doing this for some time, but have now run into an
>
EXC_BAD_ACCESS deep in the Cocoa framework during drawing, and I
>
suspect changing the subview is indirectly causing the problem.
>
>
Assuming this is bad practice, where is the best place to lazily
>
update an NSView? I have a plot class. When attributes of the plot
>
change, it needs to be updated before it is redrawn. I have been doing
>
this is in drawRect:, but updating the plot does require subviews to
>
be changed, leading to the problem above. Is there a single NSView
>
method, like display, where I could do this update before drawRect: is
>
called?
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.