Google material icon have White but want to display in different color in imageView iOS Swift


If you had downloaded the icons from google material design it had only two colors white and black.But you want to replace that white color to red, green or etc.. then follow the code.

            let Image = UIImage(named: "imageName");
            let tintedImage = Image?.withRenderingMode(.alwaysTemplate)
            Button.setImage(tintedImage, for: .normal)
            Button.tintColor = UIColor(red: 251.0/255.0, green: 38.0/255.0, blue: 77.0/255.0, alpha: 1.0)

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift