[英]tintColor of UIImageView doesn't work with storyboard,but work with code
Xcode 9 beta 6,iOS 11 Xcode 9 beta 6,iOS 11
I downloaded a Instagram logo which was a .png file,and I created a UIButton
and UIImageView
in the Main.storyboard
.The logo image was set as follows: 我下载了一个Instagram徽标,这是一个.png文件,我在Main.storyboard
创建了一个UIButton
和UIImageView
。徽标图像设置如下:
And I set the TintColor
of the UIButton
and the UIImageView
is white
,but when I run the project, the color of the image for UIImageView is still black,while white for UIButton. 我设置了UIButton
的TintColor
,而UIImageView
是white
,但是当我运行该项目时,UIImageView的图像颜色仍为黑色,而UIButton的颜色为白色。
imageView setting: imageView设置:
Why it is black for
imageView
and white forbutton
with the same setting of the image? 为什么它对于imageView
是白色而对于具有相同图像设置的button
是白色的? Thanks. 谢谢。
Additional remarks: 补充说明:
When I used code to add the subview imageView
,it worked well.Really werid! 当我使用的代码添加子视图imageView
,它的工作well.Really werid!
Apparently there is a problem with story board where if the image view is added before adding the image in xcassets as template, the Tint Color does not take effect (if set in the storyboard). 显然故事板存在问题,如果在将xcassets中的图像添加为模板之前添加图像视图,则色调颜色不会生效(如果在故事板中设置)。 I was able to reproduce the problem. 我能够重现这个问题。 I tried the following and it worked. 我尝试了下面的工作。
UIImageView
删除UIImageView
UIImageView
创建一个新的UIImageView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.