Swift Uiview Gradient

[Solved] Swift Uiview Gradient | Swift - Code Explorer | yomemimo.com
Question : swift uiview gradient

Answered by : danil-voidilov

let view = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 50))
let gradient = CAGradientLayer()
gradient.frame = view.bounds
gradient.colors = [UIColor.white.cgColor, UIColor.black.cgColor]
view.layer.insertSublayer(gradient, at: 0)

Source : https://stackoverflow.com/questions/23074539/programmatically-create-a-uiview-with-color-gradient | Last Update : Sat, 06 Feb 21

Answers related to swift uiview gradient

Code Explorer Popular Question For Swift