我正在尝试在下载过程中显示一个嵌入了进度条的操作表。下载过程中不会显示工作表,下载完成后,屏幕会变暗,就像它将显示工作表并且UI已经死亡一样。我假设有一些阻塞活动正在进行,它需要在另一个线程或其他东西上,但我还不熟悉iOS线程模型。我也假设因为我已经删除了这张纸,这就是显示器暗淡的原因。我该怎么解雇呢?设置表单的代码是:
self.pActionSheet=[[[UIActionSheet alloc] initWithTitle:@"Downloading Alerts. Please Wait.\n\n\n" delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil] autorelease];
pBarView=[[UIProgressView alloc] initWithFrame:CGRectMake(0.0f,40.0f, 220.0f, 90.0f)];
[pBarView setProgressViewStyle:UIProgressViewStyleDefault];
[pActionSheet addSubview:pBarView];
[pBarView release];
[pBarView setProgress:0.0f];
[pActionSheet showInView:self.view];
pBarView.center=CGPointMake(pActionSheet.center.x,pActionSheet.center.y);
pAmt=1.0/(float)totalDownload;
驳回它的陈述是:[pActionSheet removeFromSuperView[;
答案 0 :(得分:0)
使用performSelectorInBackground:
(reference)在另一个主题上执行下载。使用dismissWithClickedButtonIndex: - 方法来关闭操作表(reference)。
答案 1 :(得分:0)
尝试这个我希望这会帮助你
UIActionSheet *popup = [[UIActionSheet alloc]initWithTitle:@"Select Sharing Option" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook",@"Twitter",@"E-Mail",nil];
popup.tag = 1;
[popup showInView:[UIApplication sharedApplication].keyWindow];