iOS
iOS

Reputation: 3616

How to closw webView?

I am designing a webView with a close button. When the application is launched, it opens the given url. When the button is touched, i want to close the webView.

I need some button event which closes the webView. Thank you for your answers.

Upvotes: 1

Views: 253

Answers (1)

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

UIWebView inherits from UIView. So the answer is: It depends!

If you're using a UINavigationController and used

[[self navigationController] pushViewController:newUIWebController];  

you can close your UIView by using

[self.navigationController popViewControllerAnimated:YES]; 

If you're using some other method to display your view (like addSubView) you can utilize the corresponding method like removeFromSuperview.

Upvotes: 1

Related Questions