我有一个问题,无法解决。我将尝试描述问题,因此:
当UINavigationBar
的标题不是那么长时——情况是这样的:
但是如果栏的标题包含更多字符 - 它会隐藏后退按钮的标题,您可以在下一个屏幕截图中看到:
它是 iOS7 中的标准 UINavigationBar
行为吗?可能有一些方法可以解决这个问题?无论如何,在 iOS6
中情况要好得多 - 我找不到这样的问题。
最佳答案
简单修复:
创建一个带标签的 View 并将该 View 设置为导航 Controller 的标题 View
// creating title view
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 40)];
// Adding label with custom frame
UILabel *labelForTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];
[labelForTitle setCenter:titleView.center];
[labelForTitle setText:@"sfdfagd ggjhdgfjhadsgfjasgdhfgasdjfgajsdgfjashgdjhfasjdfsadjgfhsadghf"];
[titleView addSubview:labelForTitle];
// setting title view for the navigation controller.
[self.navigationItem setTitleView:titleView];
输出将是这样的:
关于ios - iOS7 bar标题过长时UINavigationBar后退按钮标题被隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20094198/