Reputation: 12421
I basically want the opacity of every layer in my UITableView instance to "fade out" at the top 10 or so pixels.
Is there any way to fade out a CALayer (or more generally, a UIView)'s opacity? It'd be similar in effect to adding a shadow with a CAGradientLayer but instead of covering the table view's other layers with another, it would apply a filter to them to make them transparent according to a gradient.
Upvotes: 0
Views: 1204
Reputation: 185671
Yes, by using the CALayer
's mask
property, but it's rather inefficient. Typically this sort of effect is done by overlaying a gradient that goes from transparent to the background color on top of your view (but this only works if you know what your background is).
Upvotes: 2