I want to create a UIView that contains gradually increasing opacity value in it. That is, the UIView’s bottom will start with 0.0 as its alpha value and it should end with 1.0 at the top of the UIView. Is it possible to make such view? Or should i separate that view and give them the various alpha value?
Thanks in Advance
For future reference, the term for that sort of effect is a
gradient.You can make a view with a gradient image behind it:
UIImageViewbehind theUIViewyou want to set a gradient onUIView‘s background color to clear.UIImageViewto a gradient PNG you have created.The gradient PNG can be 1px wide and say 64px high (or higher, depending on how smooth you want the gradient to look). Make it in a paint program (GIMP is a decent one).
A way to do it purely in code is using
CAGradientLayer: