当我的屏幕标题很大时,我看到“后退”按钮标题丢失了。我需要展示整个标题。有什么解决办法吗?
请参阅附件的屏幕截图的导航栏,我看到与长标题。

发布于 2014-02-26 00:51:35
使屏幕标题变小。您可以通过使用titleView (即UILabel )来控制它。它的优点是您可以设置它的大小,并且如果文本太大(而不是像title那样只是增长),它可以截断文本和/或使文本占据两行。
发布于 2017-03-09 11:03:38
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;
https://stackoverflow.com/questions/22029173
复制相似问题