简体   繁体   English

Tint UIButton的界面构建器中的图像与UIImageRenderingModeAlwaysTemplate

[英]Tint UIButton's image from interface builder with UIImageRenderingModeAlwaysTemplate

I have a UIButton whose image property I'm setting from interface builder. 我有一个UIButtonimage属性我是从界面构建器设置的。 I want this image to be tinted with the superview's tintColor . 我希望这个图像用superview的tintColor着色。 With code, I can set the image's rendering mode to UIImageRenderingModeAlwaysTemplate , but how do I do this from interface builder? 使用代码,我可以将图像的渲染模式设置为UIImageRenderingModeAlwaysTemplate ,但是如何从界面构建器执行此操作?

Got it after a bit of looking around. 看了一下之后得到了它。 I had the button type as custom in IB, but switching it to system type now uses the template rendering mode for the UIButton 's image . 我在IB中将按钮类型设置为自定义,但是将其切换为系统类型现在使用UIButton image的模板渲染模式。

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

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