Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Last active December 22, 2021 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanfengs/adce89c93b240c99c163a6a9023377f5 to your computer and use it in GitHub Desktop.
Save hanfengs/adce89c93b240c99c163a6a9023377f5 to your computer and use it in GitHub Desktop.
[swift渐变色] #swift
let layer = CAGradientLayer()
layer.frame = self.tabBarBottomView.bounds
layer.startPoint = CGPoint.zero
layer.endPoint = CGPoint(x: 0, y: 1)
layer.colors = [UIColor(red: 78, green: 78, blue: 78, transparency: 0).cgColor, UIColor(red: 0, green: 0, blue: 0, transparency: 0.5).cgColor]
self.tabBarBottomView.layer.addSublayer(layer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment