1: navigationController 的返回按钮自定义
SecondViewController *secondVC = [SecondViewController new];
//更改UINavigationController的返回按钮 UIBarButtonItem *backButton = [[UIBarButtonItem alloc]init]; backButton.title = @"返回"; [self.navigationItem setBackBarButtonItem:backButton]; [self.navigationController pushViewController:secondVC animated:YES];
2, 方法1在有的navigationBar hidden 的页面不好使,但是还有一种方法如下:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor grayColor]; // UIBarButtonItem * backButton = [[UIBarButtonItem alloc] init];//// backButton.image = [UIImage imageNamed:@"nav_back_n"];// backButton.title = @"hh";// [self.navigationItem setBackBarButtonItem:backButton]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back_n"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];}- (void) backAction{ [self.navigationController popViewControllerAnimated:YES];}