Search code examples
iphoneiosobjective-cuiscrollview

Make bottom part of UITextField(UIScrollView) transparent


Here's a good example that sums it up:

enter image description here

This is a UITextField that contains long text, so the user is able to scroll down to view the rest of the text.

How can I make the bottom rows appear "transparent"?

UITextField only allows setting global text properties (like color, font size, etc).


Solution

  • The trick is to create a CALayer containing a gradient and use it as mask layer of your UIView's layer (alpha values of the mask layer will be used.) see this answer:
    UIView border with fade or blur effect