navigationItem 自定义后退按钮

  1. 如果tableView启用分组的话。第一组之前会有空白。把空白去掉
 self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, -1)];

  1. 自定义后退按钮
 UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"NavBack"] originalImage] style:UIBarButtonItemStylePlain target:self action:@selector(backClick)];
  
// 后退按钮距离图片距离左边边距
UIBarButtonItem *fixedItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
fixedItem.width = -10;
self.navigationItem.leftBarButtonItems = @[fixedItem,backItem];

//自定义后退按钮后,手势返回上一级控制器的功能恢复  self.navigationController.interactivePopGestureRecognizer.delegate = nil;
    ```

你可能感兴趣的:(navigationItem 自定义后退按钮)