New to swift i want my background view 80% height to be red and rest in blue. Currently i'm doing that adding two views. I think there is a direct way to do that. Any guidance or help will be appreciated.
Thanks for help. I think i found a solution.Adding a sublayer does the trick.
self.view.backgroundColor = UIColor.red
let bottomBorder = CALayer()
let t = CGRect(x: 0.0, y: (self.view.frame.size.height/100.0)*80, width: self.view.frame.size.width, height: (self.view.frame.size.height/100.0)*20)
bottomBorder.frame = t
bottomBorder.backgroundColor = UIColor.blue.cgColor
self.view.layer.addSublayer(bottomBorder)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments