-1

I have a UIview that contains a label and an image .. I tried adding faded color to the view ..it worked but the color was on top of the other objects which made both image and label invisible...

I need the colors on both UIview and naviagtorenter image description here look like this

Akshay I
  • 3,675
  • 1
  • 34
  • 57

1 Answers1

0

You can set gradient like this,

func setTealGradientBackground() {
    let colorTeal =  UIColor(red: 0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: 1.0).CGColor
    let colorWhite = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0).CGColor
    let gradLayer = CAGradientLayer()
    gradLayer.colors = [colorTeal, colorWhite]
    gradLayer.locations = [0.0, 1.0]
    gradLayer.frame = self.view.bounds
    self.view.layer.insertSublayer(gradLayer, at:0)
}
Abdul Karim Khan
  • 4,256
  • 1
  • 26
  • 30