进度条未显示在操作表上

发布于 2024-10-15 01:54:47 字数 702 浏览 1 评论 0原文

下面的代码用于显示下载进度。操作表显示,执行下载的代码在不同的线程上运行,并随着下载的进行而更新进度。我已经使用调试器确认了这一点。问题是实际的进度条永远不会显示在操作表上。我在每次更新后都会延迟 1 秒,以确保我不会错过它。就酒吧的设置而言,我缺少什么吗?

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

The below code is used to display the progress of a download. The actionsheet displays, the code performing the download runs on a different thread and updates the progress as it goes along. I have confirmed this using the debugger. The problem is that actual progress bar never displays on the actionsheet. I have put a 1 second delay after every update to ensure that I am not missing it. Is there something I am missing as far as setup of the bar?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

淡淡的优雅 2024-10-22 01:54:47

事实证明,这就是问题所在:

pBarView.center=CGPointMake(pActionSheet.center.x,pActionSheet.center.y);

它一定是把它从视野中排除了。当我手动指定一些坐标时,它显示得很好。

Turns out that this was the problem:

pBarView.center=CGPointMake(pActionSheet.center.x,pActionSheet.center.y);

It must have been putting it out of the view. When I manually specified some coords it shows up fine.

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