Objective C-如何在后退按钮上显示viewController的简称 [英] Objective c - how to display a shorter name of viewController on back button

查看:78
本文介绍了Objective C-如何在后退按钮上显示viewController的简称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎确定我有一天会看到有一些属性可以设置当按下另一个viewController并成为后视图控制器时,在后按钮中显示的viewController的短名称. 有人可以提醒我这是什么财产吗?

I almost sure I saw someday that there is some property to set a shorter name of viewController to be display in the back button when it push another viewController and become the back viewController. Can some one remind me what is this property?

推荐答案

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    self.title = @"First View Controller";

    // this defines the back button leading BACK TO THIS controller
    UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc]
      initWithTitle:@"Back"
      style:UIBarButtonItemStyleBordered
      target:nil
      action:nil];
    self.navigationItem.backBarButtonItem = backBarButtonItem;
    [backBarButtonItem release];
    }
    return self;
}

这篇关于Objective C-如何在后退按钮上显示viewController的简称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆