mlewis54 mlewis54 - 1 year ago 114
Objective-C Question

Action sheet not displaying

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

The statement to dismiss it is:
[pActionSheet removeFromSuperView[;

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download