navigationController 返回按钮可点击区域修改

UIButton * backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 60, 44);
[backButton setImage:[UIImage imageNamed:@ "back_btn_bg.png" ] forState:UIControlStateNormal];
[backButton setTitle:@ "Back" forState:UIControlStateNormal];
[backButton setTitleEdgeInsets:UIEdgeInsetsMake(-1, -55, 0, 0)];
[backButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.0]];
[backButton setTitleColor:[UIColor colorWithRed:233.0/255.0 green:220.0/255.0 blue:207.0/255.0 alpha:1.0]
                  forState:UIControlStateNormal];
UIBarButtonItem *backNavigationItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
 
// 调整 leftBarButtonItem 在 iOS7 下面的位置
if (([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0?20:0)){
   UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]
                                      initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                      target: nil action: nil ];
   negativeSpacer.width = -10;
   self .navigationItem.leftBarButtonItems = @[negativeSpacer, backNavigationItem];
} else
   self .navigationItem.leftBarButtonItem = backNavigationItem;

你可能感兴趣的:(navigationController 返回按钮可点击区域修改)