You would really need to give details of how you're setting up this progressview...
This sounds like the right solution... I wouldn't mess around with shutting your app down, it's not how users will expect an iOS 4 application to behave. Even better if you're opening the link in Safari, you know that you shouldn't be loading the webpage yourself. So before you kick off to Safari do the cleanup.
But again any advice you get here is just going te be guess work because we don't really know what you're doing. And I don't mean any offense here, I'm guilty of myself. You get so wrapped up in what you're doing you think... Well this is obviously what I'm doing, everyone will understand it.
Yes, I know - sorry about being less than clear on this. The problem is that the code handling this is so convoluted and spread trough so many code-pages that I find it really hard to distill the function to anything that is postable on the forum.
I'll give it a shot, though, because as you say the expected behavior is that the app should be kept open in the background:
The progressview is a subview that is loaded on top of the page each time the webview is loaded with a new local html-file:
.h-file
Code:
@interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate, UIWebViewDelegate, AVAudioPlayerDelegate, PopupTextSizeDelegate> {
IBOutlet UIView *progressAlert;
}
@property (nonatomic, retain) UIView *progressAlert;
.m-file
Code:
@synthesize progressAlert;
-(void)webViewDidStartLoad:(UIWebView *)webView
{
// ----------------------
// SHOW: PROGRESS VIEW
// ----------------------
progressAlert = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
progressAlert.frame = CGRectMake(0.0f, 0.0f, 1100.0f, 1100.0f);
[self.webView addSubview:progressAlert];
progressAlert.backgroundColor = [UIColor whiteColor];
[progressAlert release];
// Also an activityview loaded here, but not important for this example I gather...
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
// ----------------------
// HIDE: PROGRESS VIEW
// ----------------------
@try {
[self performSelector:@selector(fn_HideProgressView) withObject:nil afterDelay:0.01];
}
@catch (NSException * e) {}
@finally {}
}
-(void) fn_HideProgressView
{
// ---------------------
// Stop: ProgressView
// ---------------------
if (self.progressAlert)
{
[self.webView sendSubviewToBack:progressAlert];
}
}
The strange thing with the code is that when the app returns from having been in the background, all the functions for closing the progressview are called (even the "[self.webView sendSubviewToBack

rogressAlert];" code).
Even when I try reloading a new local html-page into the webview the progressview is persistent.
This seems to indicate that perhaps I loose the handle for the current progressview as the app is pushed to the background, and when returned I can't access it. I.e. the "sendSubviewToBack"-function is not reaching the actual progressview.
This was not a problem in previous versions of the sdk, though...
The obvious solution would be to remove the progressview before opening safari, but that should already be done by the time a user clicks on a link, since fn_HideProgressView is called by webViewDidStartLoad. So I am uncertain why it appears again when the app regains focus.