I added a UIProgressView
to my UIActionSheet
to indicate the download progress. So I do not want my UIActionSheet
to be dismissed when user click the download button in it.
But is there a way to do that ?
Right now I implement didDismissWithButtonIndex delegate method to show UIActionSheet
again after it was dismissed. But I was hoping there is a better way.
UIActionSheet
is a modal view, which means that it blocks UI completely. Since blocking UI is considered a bad practice, preventing an action sheet from dismissing is not supported. Instead, you should make a completely separate progress indicator outside the action sheet.
@Yar, thanks for the answer, I will try your solution some other time.
But I am also satisfied with my current solution. UIActionSheet.h said
// Called when a button is clicked. **The view will be automatically dismissed after this call returns**
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
So I guess hit any buttons will always dismiss action sheet. Then my solution is first hide progress bar; when user hits download button, show action sheet again but hide the download button and show progress bar.
The cancel button is always there in case user wants to cancel download even after download is started.