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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]