Tutorial by Examples: cagradientlayer

// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
// View to hold the CAGradientLayer. let view: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 320)) // Initialize gradient layer. let gradientLayer: CAGradientLayer = CAGradientLayer() // Set frame of gradient layer. gradientLayer.frame = view.bounds // Color at the top of...
// Get the current colors of the gradient. let oldColors = self.gradientLayer.colors // Define the new colors for the gradient. let newColors = [UIColor.red.cgColor, UIColor.yellow.cgColor] // Set the new colors of the gradient. self.gradientLayer.colors = newColors // Initia...

Page 1 of 1