简体   繁体   中英

Image asset catalog color not changing

I added one image set and set its Render As -> Template Image.

Added one button to storyboard and changed its tint color. It works perfectly when I check in the simulator.

Issue - 1) But color don't get updated in the storyboard.

I have added one image view and changed its tint color from the storyboard.

Issue - 2) But color don't get updated in the storyboard nor the color change appears in the simulator.

I have added one image view programmatically and set its image and tint color that works perfectly in the simulator.

What might be the above issues any idea?

Issue 1) That seems issue with Xcode, next releases may come up with fix.

Issue 2) That seems issue with Xcode too.. When I faced that situation I had to add ImageView programmatically which worked. You may also try IBDesignable or Custom class or Extension which changes renderMode property.

Issue - 1) But color don't get updated in the storyboard.
have look this one : ios 7.1 UITextField tint color doesn't change in storyboard

Issue - 2) But color don't get updated in the storyboard nor the color change appears in the simulator.

this issue arise for the template rendering mode with a UIImageView in a storyboard or xib, on iOS 7 , iOS 8 , iOS9 and iOS10 cause it is still buggy.

more information check this thread Modify UIImage renderingMode from storyboard/xib file

I think so programmatically is good solution.

Was it suppose to reflect Template Image color on StoryBoard by changing Tint ?

I checked on Xcode 8.2.1 , Xcode 8.1 , Xcode 8.0 and Xcode 7.3.1

None of them reflected the color on StoryBoard. Its works fine on Simulator and iPhone though.

I don't think this functionality was ever there. Correct me if I'm wrong.

The only way I've been able to get it to work is by creating an outlet of the UIImageView and calling this in viewDidLoad (or in VC):

imageView.tintColorDidChange()

This has been a bug since iOS 7 or 8 I believe.

我认为这个问题在 Xcode 11 中得到了解决。我在 iOS 13、12 和 11 上进行了测试,现在它在故事板、模拟器和设备中运行良好在故事板和 Xib 中。

Try

Clear the derived data

Clean Project

or

Use custom button

请获取该图像视图的 iboutlet 并以编程方式更改色调颜色。

Try refreshing all views, maybe it helps:

截屏

Simply, from Xcode, go to assets > then select your image > then from Inspectors menu (on the right): change the value of Render as to Template image

在此处输入图片说明

Then go to your storyboard > then change Tint color as you wish, and voila!

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