我有以下 UIAlertView 加载指示器的代码,它不起作用并给了我
- (void) launchActivity
{
//some logic...
[NSThread detachNewThreadSelector:@selector(updateFilterProgress) toTarget:self withObject:nil];
}
- (void) updateFilterProgress {
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
{
UIAlertView *myAlert = [[[UIAlertView alloc] initWithTitle:@"No Internet Connectivity" message:@"This app require an internet connection via WiFi or cellular network to work." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease];
[myAlert show];
}
else{
UIAlertView *alertMe = [[[UIAlertView alloc] initWithTitle:@"Loading..." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles: nil] autorelease] ;
//tried this way by placing below line....no result
[alertMe performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
//[alertMe show];
//some logic...
}
更新: 在主线程上,我正在调用 Web 服务并加载数据。因此我给出了另一个加载 UIAlertView 的线程,它正在使用 iOS 4,5。但它在 iOS 6 中崩溃。如果我将 AlerView 放在主线程上,那么在加载时什么都没有显示,但在加载数据后 AlertView 显示加载指示器几秒钟。任何建议...