Modify UIImage renderingMode from a storyboard/xib file

前端 未结 16 2308
别那么骄傲
别那么骄傲 2020-12-02 08:00

Is it possible to modify a UIImage\'s renderingMode from a storyboard or xib editor?

The goal is to apply tintColor to the par

16条回答
  •  遥遥无期
    2020-12-02 08:16

    You may fix .xib issues with an extension:

    import UIKit
    
    // fixing Bug in XCode
    // http://openradar.appspot.com/18448072
    extension UIImageView {
        override open func awakeFromNib() {
            super.awakeFromNib()
            self.tintColorDidChange()
        }
    }
    

    Source: https://gist.github.com/buechner/3b97000a6570a2bfbc99c005cb010bac

    Amazing, this bug has been around for like 4-5 years now.

提交回复
热议问题