can the button responce the second click before the first is finished before?
can the button responce the second click before the first is finished before?
- Subject: can the button responce the second click before the first is finished before?
- From: XiaoGang Li <email@hidden>
- Date: Wed, 28 Oct 2009 17:19:29 +0800
when user click the OK button, the application will fall into a for loop for
a long time, how to jump out the for loop without using multi-threads? like
this:
BOOL bStop = NO;
- (IBAction)okButton:(id)sender
{
//user can click the button again to stop the action to continue.
[okButton setTitle:@"Stop"];
[okButton displayIfNeeded];
//N is a big number, and the doSomething method is a time consumer too.
for(int i=0; i<N && !bStop; i++)
{
[self doSomething];
}
bStop = YES;
}
the problem is that when the application begain to execute the action, the
mousr will begain to busy state, and apparently the okButton can not
response again.
when user click the ok button (titled Stop) again, the application need to
jump out the for loop if the bStop flag changed to YES. How to implement it?
thanks.
_______________________________________________
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