Re: Modal event processing
Re: Modal event processing
- Subject: Re: Modal event processing
- From: Charlie Dickman <email@hidden>
- Date: Fri, 06 Jul 2012 16:02:58 -0400
I just had a look at the NSAnimation class document and it actually suggests very prominently that, because of the limited capabilities of an NSAnimation, an NSTimer be used.
I also just went back over the architecture of my app with Uli's comments in mind and have discovered that I think I am actually doing what he suggests. I am not polling for events nor am I trying to drive the run loop myself.
In my view's drawRect method I use a global state variable that defines the next function to perform. When drawRect gets called I do what is necessary for the current state, set up for the next state, set the value for the next state and then return from drawRect. So the primary driving force is the periodic view update requirement (which is guaranteed by actions invoking [self setNeedsDisplay: YES]).
Within the execution of a particular function I use NSTimers to drive the steps of that function ultimately exiting back to the dispatch stack in drawRect.
So I am at a loss as how to better allow the system to do a better job of servicing menu clicks or keyboard presses.
Can you help me to see what I am missing?
On Jul 6, 2012, at 10:22 AM, Richard Altenburg (Brainchild) wrote:
> In a situation similar to yours, I ended up replacing the NSTimer with an NSAnimation. The animation I was doing was way faster after this tiny change, plus the user interface was not blocked at all. I refresh my animation 30 times per second now without any negative effect for the user. I think it is worth a try in your case before you rethink your application.
>
>
> [[[Brainchild alloc] initWithName:@"Richard Altenburg"] saysBestRegards];
>
> Op 6 jul. 2012, om 15:38 heeft Charlie Dickman het volgende geschreven:
>
>> I'll have to re-architect the app.
>
Charlie Dickman
email@hidden
_______________________________________________
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