我想在按钮操作上启动繁忙指示器,我在 IB 操作中使用以下代码:
busyIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
busyIndicator.center = self.view.center;
[busyIndicator setColor:[UIColor redColor]];
[self.btnInjuryPrevention addSubview:busyIndicator];
[self.view addSubview:busyIndicator]; // spinner is not visible until started
[busyIndicator startAnimating];
if(![AppStatus isAppOnline]) {
noInternetViewController = [[NoInternetViewController alloc] initWithNibName:@"NoInternetViewController" bundle:[NSBundle mainBundle]];
noInternetViewController.view.tag = CHILD_CONTROLLER_TAG;
[self.navigationController pushViewController:noInternetViewController animated:YES];
NSLog(@"Yoy are offline..>!!");
}
else
{
mInjuryPreventionViewController=[[InjuryPreventionViewController alloc] initWithNibName:@"InjuryPreventionViewController" bundle:nil withHeader:@" Injury Prevention" withId:INJURY_PREVENTION_ID];
mInjuryPreventionViewController.view.tag = CHILD_CONTROLLER_TAG;
[self.navigationController pushViewController:mInjuryPreventionViewController animated:YES];
//[mInjuryPreventionViewController release];
}
// [self removeLoadingView];
[busyIndicator stopAnimating];
我使用上面的代码,但是繁忙的指示器不会启动,所以你能告诉我这可能吗?