我正在尝试动态创建一个视图控制器并设置它的视图和标题栏。事情似乎工作得很好。但是当我尝试设置导航栏的左键或右键时,它们只是不显示。我究竟做错了什么?
UIWebView *tempWebView = [[UIWebView alloc] initWithFrame:self.view.bounds];
[tempWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"someurl"]]];
UIViewController* tempViewController = [[UIViewController alloc]init];
tempViewController.view = tempWebView;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tempViewController];
UIBarButtonItem* closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:nil];
navigationController.navigationItem.leftBarButtonItem = closeButton;
[self presentViewController:navigationController animated:YES completion:nil];