0

I have a gradient layer that isn't filling the view it's assigned to. The constraints on view are top, left, right 0 and bottom 8. Below will be the code of the gradient and an image of the issue. The buttons are also inside the view so you can see that it is in fact filling the width of the screen. I greatly appreciate any help on this. It's making absolutely no sense to me.

Here's the code:

let gradientLayer = CAGradientLayer()
let picker = UIImagePickerController()

override func viewDidLoad() {
    super.viewDidLoad()

    // Setup gradient
    gradientLayer.frame = self.gradientBackground.bounds
    gradientLayer.colors = [Constants.Colors.brightOrange.cgColor, Constants.Colors.lightOrange.cgColor]
    gradientLayer.locations = [0.0,1.0]
    self.gradientBackground.layer.insertSublayer(gradientLayer, at: 0)

Here's the image:

0 Answers0