I have a bottom toolbar button that contains a button which opens a UIWebView *webView
- (IBAction)rebateWebView:(id)sender {
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}
Now, after the webView loads I want to change the title of the button and when the button is tapped again I want the webView to disappear or, in essence, reload the firstviewcontroller.
I know how to change the title and have that working. My biggest problem is dropping the webView. I just can’t wrap my head around it.
[self.webView removeFromSuperView];will remove yourwebViewfrom the super view, which is almost certainly your view controller’sself.view.Then depending on whether you still need it or not you may want to
nilit out and/orreleaseit if you are not using ARC.If you are trying to “reload” the view controller instead (which is completely different from dropping
self.webView, you can call[self viewWillDisappear:NO]; [self viewWillAppear:NO];if what you need is in those methods.Edit
Jim’s suggestion is also valid if you may want to re-show that
self.webViewin the future:self.webView.hidden = YESto hideself.webView.hidden = NOto show