Created
June 16, 2018 12:52
-
-
Save EricADockery/413c89af68dab0cdbda42e54014541ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GradientView: UIView { | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
let gradientLayer = CAGradientLayer() | |
gradientLayer.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height) | |
gradientLayer.colors = [UIColor.white.cgColor,UIColor.red.withAlphaComponent(0.5).cgColor] | |
gradientLayer.startPoint = CGPoint(x: 0.0, y: 1.0) | |
gradientLayer.endPoint = CGPoint(x: 1.0, y: 1.0) | |
layer.addSublayer(gradientLayer) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment