Im getting a very weird behaviour from when I add a subview to my main view in one function (the viewWillAppear), and then remove it in another function (webViewDidFinishLoading).
I need the delay between them in order to measure how long the ActivityIndicator should be active (which is until the webpage loaded into the UIWebView is completely loaded, which the webViewDidFinishLoad-function indicates).
Most things function as normal. What does not function, and actually halts the entire app, are links (clicked on <a href="">-tags) from within the various html-pages loaded into the UIWebView.
This is the code-snippet:
Note that this seems to have nothing to do with the UIActivityIndicator as such, since Ive also tried loading a UIView in the first function, and removing it in the second, and end up with the same problem.
Also, if I remove the activityView in the first function (which would remove it too soon), this problem disappears.
The same is true if I remove it for instance in a viewDidFinishLoad()-function instead. This will however also remove it too soon, making this solution a no go for my purpose.
Ive also tried adding the subview to, for instance the webview instead, but the same problem presists even then.
Any idea as to how to solve this problem?
I need the delay between them in order to measure how long the ActivityIndicator should be active (which is until the webpage loaded into the UIWebView is completely loaded, which the webViewDidFinishLoad-function indicates).
Most things function as normal. What does not function, and actually halts the entire app, are links (clicked on <a href="">-tags) from within the various html-pages loaded into the UIWebView.
This is the code-snippet:
Code:
// 1. Before the UIWebView is loaded, we load an UIActivityIndicator into the main view
- (void)viewWillAppear:(BOOL)animated
{
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.frame = CGRectMake(143.0f, 250.0f, 32.0f, 32.0f);
[self.view addSubview:activityView];
[activityView startAnimating];
[activityView release];
}
// 2. Then removes the UIActivityIndicator when the UIWebView has been loades
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[activityView stopAnimating];
[activityView removeFromSuperview];
}
Note that this seems to have nothing to do with the UIActivityIndicator as such, since Ive also tried loading a UIView in the first function, and removing it in the second, and end up with the same problem.
Also, if I remove the activityView in the first function (which would remove it too soon), this problem disappears.
The same is true if I remove it for instance in a viewDidFinishLoad()-function instead. This will however also remove it too soon, making this solution a no go for my purpose.
Ive also tried adding the subview to, for instance the webview instead, but the same problem presists even then.
Any idea as to how to solve this problem?