首页 文章

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

提问于
浏览
0

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

请参阅我附带长 Headers 导航栏的屏幕截图 .

enter image description here

2 回答

  • 4

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

  • 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;

相关问题