Naresh Venkat
Naresh Venkat

Reputation: 163

UIWebview is not closed

I am developing one application, in that I am using UIWebview and am opening the youtube on that webview.

I added close button for closing the webview, when i open the video on youtube and I click on close button, webview get closed but video sound is still playing.

So please tell me how can I remove the webview from my main view.

My close button code:

- (void)cancel:(UITapGestureRecognizer *)recognizer {
      [web stopLoading];
      [web removeFromSuperview];
      [cnclbtn removeFromSuperview];
}

Upvotes: 1

Views: 153

Answers (1)

Murali
Murali

Reputation: 1889

Try this....It may solve your issue...

Before removing from super view just load that webview with empty html page like this...

- (void)cancel:(UITapGestureRecognizer *)recognizer {
  [web stopLoading];
  [web loadHTMLString:@"<html><head></head><body></body></html>" baseURL:nil];
  [web removeFromSuperview];
  [cnclbtn removeFromSuperview];
}

Upvotes: 1

Related Questions