UIBarButtonItem图片颜色改变了

2017-03-15  本文已影响339人  Kevin追梦先生

//图片变色

[[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]];

上一篇 下一篇

猜你喜欢

热点阅读