我有个问题,但解决不了。我将尝试描述这个问题,所以:
当UINavigationBar的标题不是那么长时,情况是这样的:

但是,如果条形图的标题包含更多字符--它隐藏了后退按钮的标题,在下一个屏幕截图中可以看到:

这是UINavigationBar在iOS7中的标准行为吗?也许有什么办法可以解决这个问题?无论如何,在iOS6,情况要好得多--在那里我找不到像这样的问题。

发布于 2013-11-20 11:28:07
简单修复:
使用label创建一个视图,并将该视图设置为导航控制器的标题视图。
// 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];输出如下:

https://stackoverflow.com/questions/20094198
复制相似问题