iOS 7中长屏幕标题缺少后退按钮标题

时间:2014-02-26 00:24:41

标签: ios objective-c cocoa-touch uinavigationcontroller uinavigationbar

当我的屏幕标题很大时,我看到“Back”按钮标题丢失了。我需要展示整个标题。这有什么解决方法吗?

请参阅我附带长标题的导航栏截图。

enter image description here

2 个答案:

答案 0 :(得分:4)

缩小屏幕标题。你可以使用一个UILabel titleView来控制它。优点是你可以设置它的大小,并且它可以截断它的文本和/或如果文本太大而使文本占据两行(而不是像title那样只是增长)。

答案 1 :(得分:0)

UIView *iv = [[UIView alloc] initWithFrame:CGRectMake(0,0,170,35)];
[iv setBackgroundColor:[UIColor whiteColor]];

_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 170, 35)];
_titleLabel.textAlignment = UITextAlignmentCenter;
[_titleLabel setFont:[UIFont boldSystemFontOfSize:16.0]];
[_titleLabel setBackgroundColor:[UIColor clearColor]];
[_titleLabel setTextColor:[UIColor blackColor]];
[_titleLabel setText:@""];
_titleLabel.clipsToBounds = false;
iv.clipsToBounds = false;
[iv addSubview:_titleLabel];
[self.navigationItem setTitleView:iv];

你也需要     @property(强,非原子)UILabel * titleLabel;