iOS - Globally change navigation bar title color using appearance?

前端 未结 6 1788
情歌与酒
情歌与酒 2021-02-07 00:56

This crashes the app:

[[UINavigationBar appearance] setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];

Is there a way to do

6条回答
  •  不要未来只要你来
    2021-02-07 01:48

    That crashes the app before UINavigationBar doesn't have a title or state... Those are UIButton methods

    You need

    [[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
    

提交回复
热议问题