Progress bar not displaying on actionsheet
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.
精彩评论