你是否改變了字體大小 - 這可能改變了行高值導致位移?
最好選擇自定義後退按鈕,這樣您可以更好地控制展示位置。你可以把這個片段在viewDidLoad中
if ([self.navigationController.viewControllers count] > 1)
{
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[backBtn setAdjustsImageWhenHighlighted:NO];
[backBtn setShowsTouchWhenHighlighted:YES];
[backBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
UIImage *backBtnImage = [UIImage imageNamed:@"back.png"]; // <-- Use your own image
[backBtn setImage:backBtnImage forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
backBtn.frame = CGRectMake(0, 0, 40, 40);
UIBarButtonItem *backBarBtnItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backBarBtnItem;
}
還要添加方法定製後退按鈕觸摸事件:
- (void)goBack
{
[self.navigationController popViewControllerAnimated:YES];
}