I am trying to create UIWebView programmatically that will be opened in a modal view. I am having troubles adding a button to dismiss the view. This is what I have so far on the main view:
I am not sure how to tell the done button its job is to dismiss the modal view. Any suggestions?
Code:
CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 480);
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
[webView setBackgroundColor:[UIColor greenColor]];
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view = webView;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
//viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
[updateController presentViewController:navigationController animated:YES completion:nil];
I am not sure how to tell the done button its job is to dismiss the modal view. Any suggestions?
Last edited by a moderator: