Re: Changing subviews during drawing
Re: Changing subviews during drawing
- Subject: Re: Changing subviews during drawing
- From: j o a r <email@hidden>
- Date: Wed, 31 Mar 2004 11:35:15 +0200
On 2004-03-31, at 11.16, Drew McCormack wrote:
>
I guess this is a solution, but sort of defeats the purpose of making
>
the changes 'lazily'. The thing is, there may be lots of attributes
>
set, and you don't really want to re-layout the plot (eg setup axes
>
etc) until you need to, otherwise you have to do it every time
>
something changes, which is wasteful.
>
>
One solution would be to make the user of the class explicitly call
>
the 'layout' method when they have changed the attributes. This is not
>
a bad solution, but I can't help thinking this is something which
>
should happen automatically, and only when a redraw is required.
Just pool the requests then:
==========================================================
- (void) delayedUpdate
{
[self doWhateverCleanupIsNeeded];
[myView setNeedsDisplay: YES];
}
- (void) updateAfterDelay
{
[[self class] cancelPreviousPerformRequestsWithTarget: self];
[self performSelector: @selector(delayUpdate) withObject: nil
afterDelay: 0.0];
}
- (void) changeAttributeToSomePhoneyValue:(int) theNewValue
{
theValue = theNewValue;
[self updateAfterDelay];
}
- (void) changeSomeOtherAttribute:(int) theNewValue
{
theOtherValue = theNewValue;
[self updateAfterDelay];
}
==========================================================
j o a r
[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.