美文网首页
UIBarButtonItem图片颜色改变了

UIBarButtonItem图片颜色改变了

作者: Kevin追梦先生 | 来源:发表于2017-03-15 16:19 被阅读339次

//图片变色

[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"barbuttonicon_back"] style:UIBarButtonItemStylePlain actionBlick:^{

      [self.navigationController popViewControllerAnimated:YES];

}]

This is clearly explained in Apple's document, "Toolbars": Bar Button Item Icons Any bar button in a toolbar can have a custom image instead of text. You can provide this image to your bar button item during initialization. Note that a bar button image will be automatically rendered as a template image within a toolbar, unless you explicitly set its rendering mode to UIImageRenderingModeAlwaysOriginal. For more information, see Template Images.

//文字变色

//设置BarButtonItem文字颜色

[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];

相关文章

网友评论

      本文标题:UIBarButtonItem图片颜色改变了

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