UINavigationControll采用pushViewController后如何去掉左边的返回按钮

2种方式:

1、前者在主视图中

示例:

UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] init];

temporaryBarButtonItem.title = @"";

self.navigationItem.backBarButtonItem = temporaryBarButtonItem;

[temporaryBarButtonItem release];

2、self.navigationItem.hidesBackButton = YES,后者在子视图中用

示例:

self.navigationItem.hidesBackButton = YES;

UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(backItemClick)];

self.navigationItem.leftBarButtonItem = backItem;

你可能感兴趣的:(UINavigationControll采用pushViewController后如何去掉左边的返回按钮)