操作表不显示

发布于 2024-10-14 21:51:49 字数 903 浏览 2 评论 0原文

我试图在下载过程中显示一个带有嵌入进度条的操作表。下载过程中不会显示工作表,下载完成后,屏幕会变暗,就像要显示工作表一样,并且 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谜兔 2024-10-21 21:51:49

使用 performSelectorInBackground: 在另一个线程上执行下载 (参考)。使用 dismissWithClickedButtonIndex: - 方法关闭操作表 (

Perform the download on another thread with performSelectorInBackground: (reference). Use the dismissWithClickedButtonIndex: - method to dismiss the action sheet (reference).

仙气飘飘 2024-10-21 21:51:49

试试这个我希望这会帮助你

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];

try this i hope this will helps you

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];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文