How to change the text color on UINavigationBar button items

前端 未结 8 1607
梦如初夏
梦如初夏 2020-12-24 00:12

I\'ve got a UINavigationController and i\'ve changed it to white using the Tint property of the navigation bar in Interface Builder. But the text in buttons and the title is

8条回答
  •  隐瞒了意图╮
    2020-12-24 00:29

    you can change title appearance by adding label into the navigation bar like bellow.

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 35)];
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = UITextAlignmentCenter;
    label.textColor =[UIColor whiteColor];
    label.text=self.title;
    self.navigationItem.titleView = viewLabel;
    [label release]; 
    

提交回复
热议问题