Created
May 2, 2018 06:09
-
-
Save FromAtom/f078bbe73301ec6a4e2e12a1b3ec62de to your computer and use it in GitHub Desktop.
TableViewの上下を透明グラデーションにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLayoutSubviews() { | |
super.viewDidLayoutSubviews() | |
let gradient = CAGradientLayer() | |
gradient.frame = tableView.superview?.bounds ?? .null | |
gradient.colors = [UIColor.clear.cgColor, UIColor.black.cgColor, UIColor.black.cgColor, UIColor.clear.cgColor] | |
gradient.locations = [0.0, 0.1, 0.9, 1.0] | |
tableView.superview?.layer.mask = gradient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment