alllllllll 2013-06-18 02:32 采纳率: 0%
浏览 6280
已采纳

修改UInavigationbar标题

有两个屏幕,要实现点击第一个屏幕导航栏的按钮,在第二个屏幕中改变。我用了storyboard。

第一个屏幕的代码:

-(IBAction) ChangeSecondPageTitle: (id) sender {

SecondViewController *second=[[self storyboard] instantiateViewControllerWithIdentifier:@"second"];
        second.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
          second.detailTitle.topItem.title=@"example";
        [self presentModalViewController:second animated:YES];
}

第二个屏幕的.h文件:

@property (weak, nonatomic) IBOutlet UINavigationBar *detailTitle;
  • 写回答

2条回答 默认 最新

  • g989_1314125 2013-06-18 06:58
    关注

    我猜想你是要设置第二屏幕导航条的标题

    使用导航控制器显示第二个屏幕。

    在SecondDetailViewController 市里中,保持NSString属性:

    @property (strong, nonatomic) NSString *navBarTitle;
    

    在viewDidLoad,设置标题:

    [self setTitle:navBarTitle];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?