美文网首页
iOS 导航栏切换颜色,字体颜色

iOS 导航栏切换颜色,字体颜色

作者: 旧时凉梦已成风 | 来源:发表于2019-03-11 13:53 被阅读0次

//进入页面时设置颜色:特别设置

- (void)viewWillAppear:(BOOL)animated{

    [superviewWillAppear:animated];

    [self.navigationController.navigationBar setBarTintColor:kWhiteColor];

    [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:

                                                                      kBlackColor,NSForegroundColorAttributeName,

                                                                      FONT_SIZE(18),NSFontAttributeName,nil]];

}

//离开页面时还原为全局设置:原本主题

- (void)viewWillDisappear:(BOOL)animated{

    [super viewWillDisappear:animated];

    [self.navigationController.navigationBar setBarTintColor:KIndexNavgitionColor];

    [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:

                                                                      RGBCOLOR(13,13,13),NSForegroundColorAttributeName,

                                                                      FONT_SIZE(18),NSFontAttributeName,nil]];

}

相关文章

网友评论

      本文标题:iOS 导航栏切换颜色,字体颜色

      本文链接:https://www.haomeiwen.com/subject/luavpqtx.html