I’m trying to add a button to a modal view controller so it can be dismised but the button is not displaying. Any help would be appreciated.
Here is the code:
UIViewController* webView = [[UIViewController alloc] init];
UINavigationController* modalViewController = [[UINavigationController alloc] initWithRootViewController:webView];
[webView release];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(hideModalView)];
modalViewController.navigationItem.rightBarButtonItem = doneButton;
[doneButton release];
[globalNavController presentModalViewController:modalViewController animated:YES];
You should do it like this.