我写了这段代码来定义UIAlertView
-(void)showAlertMethod2 {
progressAlert2 = [[UIAlertView alloc] initWithTitle:@"تتم المزامنة..يرجى الانتظار ...\n" message:@"" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
CGRect alertFrame = progressAlert2.frame;
UIActivityIndicatorView* activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicator.frame = CGRectMake(135,alertFrame.size.height+55, alertFrame.size.width,30);
activityIndicator.hidden = NO;
activityIndicator.contentMode = UIViewContentModeCenter;
[activityIndicator startAnimating];
[progressAlert2 addSubview:activityIndicator];
[progressAlert2 show];
}
-(void)dismissAlertMethod2
{
[progressAlert2 dismissWithClickedButtonIndex:0 animated:YES];
}
我在这里打电话:
[NSThread detachNewThreadSelector:@selector(showAlertMethod2) toTarget:self withObject:nil];
[self performSelector:@selector(syncToServer) withObject:nil];
[self performSelector:@selector(syncFromServer) withObject:nil]
[NSThread detachNewThreadSelector:@selector(dismissAlertMethod2) toTarget:self withObject:nil];
syncToServer
是一种将数据同步到服务器的方法,syncFromServer
是将数据同步到服务器
问题是UIAlertView
没有显示,有人知道错过了什么吗?提前致谢。