Re: NSProgressIndicator, MUST use threads?
Re: NSProgressIndicator, MUST use threads?
- Subject: Re: NSProgressIndicator, MUST use threads?
- From: Malte Tancred <email@hidden>
- Date: Tue, 14 Dec 2004 14:20:02 +0100
On Dec 14, 2004, at 3.21, Matthew wrote:
//this method obviously runs forever, but neither barber pole spins
during that time.
- (IBAction)startSpinning:(id)sender
{
[barberPole startAnimation:nil];
while (TRUE) {
// [barberPole animate:nil];
[barberPole2 animate:nil];
}
}
Is there a way to get this to animate without using threads?
Yes. You can issue a delayed perform? Like this:
- (IBAction)toggleSpinning:(id)sender {
if (!isSpinning) {
[self performSelector:@selector(startSpinning) withObject:nil
afterDelay:0.0];
} else {
[self performSelector:@selector(stopSpinning) withObject:nil
afterDelay:0.0];
}
}
- (void)startSpinning {
[pole startAnimation:self];
isSpinning = YES;
}
- (void)stopSpinning {
[pole stopAnimation:self];
isSpinning = NO;
}
You could of course send the message to the progress indicator directly
as well (that is [pole performSelector:@selector(startAnimation:)
withObject:self afterDelay:0.0]).
Regards,
Malte
--
Malte Tancred
Computer Programmer
Oops AB, http://oops.se/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden