简体   繁体   English

可以对基于customview的UIBarButtonItem使用色彩颜色吗?

[英]Possible to use tint color for a customview based UIBarButtonItem?

Is it possible to color cutomview based UIBarButtonItem like normal UIBarButtonItem ? 是否可以像常规UIBarButtonItem一样对基于UIBarButtonItem UIBarButtonItem

UIBarButtonItem *update = [[UIBarButtonItem alloc] initWithCustomView:b];

Or is it know which tint color is the default? 还是知道默认哪种颜色?

Should I recolor the image with standard tint color (0, 122, 255)? 是否应使用标准色(0、122、255)对图像重新着色?

在此处输入图片说明

Try to set your image like this: 尝试像这样设置图像:

UIImage(named: "imagename")?.withRenderingMode(.alwaysTemplate)

You can also set Render As to Template Image in the asset catalog instead. 您也可以在资产目录中设置“ Render AsTemplate Image ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM