进度条未显示在操作表上
下面的代码用于显示下载进度。操作表显示,执行下载的代码在不同的线程上运行,并随着下载的进行而更新进度。我已经使用调试器确认了这一点。问题是实际的进度条永远不会显示在操作表上。我在每次更新后都会延迟 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这就是问题所在:
它一定是把它从视野中排除了。当我手动指定一些坐标时,它显示得很好。
Turns out that this was the problem:
It must have been putting it out of the view. When I manually specified some coords it shows up fine.