我正在使用 NetworkActivityIndicator 来表明我的应用程序正在做一些工作。当我在模拟器中运行应用程序时,它会显示我想要的方式 - 基本上一直旋转直到所选选项卡从服务器加载数据 - 但是当我将应用程序放到手机上时,我只得到一瞬间微调器在它消失之前。通常只在视图出现在屏幕上之前旋转。
想法?
编辑:问题可能与我使用 TabBar 的事实有关......在模拟器中,ActivityIndicator 将在 Screen/Tab 1 上旋转,而 Screen/Tab 2 正在加载。在电话上,我只在屏幕 2 终于出现后的一瞬间看到了 ActivityIndicator。
-(void)viewDidLoad {
// call to spinTheSpinner
[NSThread detachNewThreadSelector:@selector(spinTheSpinner) toTarget:self withObject:nil];
// method to Get the Data from the Server
[self getDataFromServer];
}
-(void)spinTheSpinner {
NSLog(@"Spin The Spinner");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[self performSelectorOnMainThread:@selector(doneSpinning) withObject:nil waitUntilDone:YES];
[pool release];
}
-(void)doneSpinning {
NSLog(@"done spinning");
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
-(void)getDataFromServer {
// does a bunch of stuff to retrieve and display data
}