> On 5 Feb 2016, at 10:52 AM, Jeff Evans <jev...@ars-nova.com> wrote:
> 
> Clark, it's a music app; a piece is composed and placed on the screen; 
> there's a lot of massaging going on as the music adjusts visually. I want the 
> play of the example to begin once there are no more updates remaining. That 
> is no noticeable delay in terms of human time, but makes a difference in the 
> appearance.
> 
> So I figure: the system presumably knows if it is about to send more redraw 
> requests to that view. Is there any way I could know what it knows?


Personally, I think you are abusing the view here - it should obediently 
display what it’s told, not be part of your underlying logic.

However, there’s an easy-ish way to do what you want, if a little hacky.


- (void)        drawRect:(NSRect) dirty
{
        [NSObject cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(doStuffWhenIdle) object:nil];

        /* do whatever you need to draw the view */

        [self performSelector:@selector(doStuffWhenIdle) withObject:nil 
afterDelay:MY_IDLE_TIME];
}


- (void) doStuffWhenIdle
{
        // will be called once there are no more -drawRect calls and 
MY_IDLE_TIME has elapsed


        ….
}



—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to