Closed captainhaddockfr35 closed 3 years ago
Hi,
Is it possible to make a background with a color gradient ? I tried by adding a layer :
public override func viewDidLoad() { super.viewDidLoad() let colorTop = UIColor(red: 255.0/255.0, green: 149.0/255.0, blue: 0.0/255.0, alpha: 1.0).cgColor let colorBottom = UIColor(red: 255.0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0).cgColor let gradientLayer = CAGradientLayer() gradientLayer.colors = [colorTop, colorBottom] gradientLayer.locations = [0.0, 1.0] gradientLayer.frame = self.buttonBarView.bounds self.buttonBarView.layer.insertSublayer(gradientLayer, at: 0) }
but since the content size is larger than the screen size, when I scroll to the items on the right, the gradient does not expand.
Thanks
Hi,
Is it possible to make a background with a color gradient ? I tried by adding a layer :
but since the content size is larger than the screen size, when I scroll to the items on the right, the gradient does not expand.
Thanks