I'm looking for method to add gradually fading or maybe blured border (I don't exactly know how to name this effect) to arbitrary UIView. I don't need animated effect, I need static effect, for example I my UITableView border being partially transparent. I've made the example:
So you can see what I'm trying to do.
Can anyone help me?
There's a tutorial at Cocoanetics that does that exact thing.
I'll say this first, iKiR's answer was more than enough for me. I copied the code as it is, and with little experience from my side, I was able to make it work effortlessly (on a
UITableView
).MaskingView
QuartzCore
framework!initWithCoder:
and/orinitWithFrame:
as appropriate)MaskingView
. (In Interface Builder, user Editor -> Embed In -> View. Then, choose the class of the new superview asMaskingView
)NOTES:
The Code:
I've found a solution - I've useed CALayer's property mask:
Using this code I have UITableView with fading border
Here's iKiR and Mazyod's answer, translated to Xamarin.iOS (Monotouch). Note that there's no need to draw rectangles before and after the gradient if you just pass the right flags to the the
DrawLinearGradient
method:You might try placing a semi-transparent PNG file over the bottom of the UITableView.