After applying gradient to the view the result is as shown on the picture. Gradient colour (yelow part) doesn't stretch to the view bounds. Both yellow and red is is the same view. Can't figure out what's going on. And here's my code:
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds
//gradientLayer.frame = frame
//gradientLayer.bounds = frame
gradientLayer.colors = [colorOne.cgColor, colorTwo.cgColor]
gradientLayer.locations = [0.0, 1.0]
gradientLayer.startPoint = CGPoint(x: 1.0, y: 1.0)
gradientLayer.endPoint = CGPoint(x: 0.0, y: 0.0)
layer.insertSublayer(gradientLayer, at: 0
colorOne
and colorTwo
are defined elsewhere.
)
Anyone encounter the same problem?