我要开始按钮的动作示忙,我用IB行动,下面的代码:如何在iOS上的按钮操作上显示繁忙的指示灯?
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];
我上面的代码中使用,但忙碌的指示灯将无法启动,所以,你可以告诉我这是可能的吗?
请显示整个方法。该方法是否在'[busyIndicator startAnimating]之后立即结束;'? – dasblinkenlight 2012-07-25 10:20:50
尝试'UIActivityIndicatorViewStyleGray',你可能看不到指示器,因为我相信它已经在iOS 4中失去了阴影。 – 2012-07-25 10:23:15
确保你设置了活动指示器的框架 - 我相信初始化框架等于CGRectZero。 – 2012-07-25 10:30:06