开发者

Progress bar not displaying on actionsheet

开发者 https://www.devze.com 2023-02-07 16:18 出处:网络
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 co

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.pA开发者_高级运维ctionSheet=[[[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);


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消