简体   繁体   中英

SF Symbols Multicolored icons

Im making an app with weather icons, and i wanted to use apple's SF Symbols. At WWDC2020 they released multicolred ones.

So my question is, why are my icons appearing in black like so:

在此处输入图像描述

I have set the rendering mode to alwaysOriginal. And it does nothing. If i set it to template it becomes blue, like the default tint color.

currentConditionImageView.image = UIImage(systemName: "cloud.sun.fill")!.withRenderingMode(.alwaysOriginal)

But according to the SF Symbols app, the symbol should look like this:

在此处输入图像描述

Has anyone encountered this Problem, and how did you solve it? Im looking forward to your answers!

The rule is:

In a template environment, such as a button, if you apply the .alwaysOriginal rendering mode to a multicolor symbol image, its inherent colors will appear.

But an image view is not a template environment. Try making this image the image (not the background image) of a UIButton.

在此处输入图像描述

If you put a multicolored image in a non-template environment, like an image view, you are basically misusing it if you make it .alwaysOriginal . You should just make it .alwaysTemplate and accept it as a monochrome image adopting the tint color.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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