使用分段控件切换 NavigationItem 标题

Switch NavigationItem title with segmented control

我有一个导航项和一个导航栏。导航项有标题(和按钮),导航栏(在导航项下方)有分段控件。

如何才能在按下分段控件的一侧时更改导航项上的标题 (objective-c)?

这是 .m 文件中的代码

   if (segmentController.selectedSegmentIndex == 0) {
            UIWebView *webview6=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
     NSString *url6=@"http://apple.com";
        NSURL *nsurl6=[NSURL URLWithString:url6];
            NSURLRequest *nsrequest6=[NSURLRequest requestWithURL:nsurl6];
        [webview6 loadRequest:nsrequest6];
 webview6.scrollView.bounces = NO;
        [self.view addSubview:webview6];
        [self.view bringSubviewToFront: navbar2];
    }
    if (segmentController.selectedSegmentIndex == 1) {
       UIWebView *webview7=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
         NSString *url7=@"http://yahoo.com";
        NSURL *nsurl7=[NSURL URLWithString:url7];
            NSURLRequest *nsrequest7=[NSURLRequest requestWithURL:nsurl7];
        [webview7 loadRequest:nsrequest7];
        webview7.scrollView.bounces = NO;
        [self.view addSubview:webview7];
        [self.view bringSubviewToFront: navbar2];
        }

这是它的样子 -

使用self.navigationItem.title设置标题。