我有一个名为“刷新数据”的UIBarButtonItem。 当用户点击它时,应用程序应刷新其数据。 点击这个button会发生什么事情,Web服务被启动,XML数据被带入,它们的顺序为30000-40000条logging。 所以为了防止UI挂起我写了一个后台线程,并在那里加载。 – (void)refreshDataAction { NSLog(@"Refresh Data"); //Put up an alert box indicating user to wait while data is loading. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Data is Loading" message:@"Please wait while data is being refreshed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; alert.tag = 10; [alert show]; } – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog(@"hit in clickedbuttonatindex […]