操作表不显示
我试图在下载过程中显示一个带有嵌入进度条的操作表。下载过程中不会显示工作表,下载完成后,屏幕会变暗,就像要显示工作表一样,并且 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[;
I am trying to display an action sheet with a progress bar imbedded in it during downloads. The sheet doesn't display during downloads and when the download is done, the screen dims as if it is going to present the sheet and the UI is dead. I assume there is some blocking activity going on and it needs to be on another thread or something but I am not familiar with the iOS threading model yet. I also assume because I've removed the sheet, that is why the display is dim. How can I dismiss it? The code to set the sheet up is:
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;
The statement to dismiss it is: [pActionSheet removeFromSuperView[;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
performSelectorInBackground:
在另一个线程上执行下载 (参考)。使用 dismissWithClickedButtonIndex: - 方法关闭操作表 (Perform the download on another thread with
performSelectorInBackground:
(reference). Use the dismissWithClickedButtonIndex: - method to dismiss the action sheet (reference).试试这个我希望这会帮助你
try this i hope this will helps you