Ios alpha mask on scrollview

I know you can mask the image in ios, but can you mask the scroll? I want the alpha mask to display the scroll, so that the contents at the ends disappear before it is cropped by the scroll. Is this possible?

FYI I already tried a job that "fakes" this effect, and they do not work because of the dynamic background. I need strict alpha masking on scrollview, if at all possible.

+4
source share
3 answers

You can fake this effect by padding the image with alpha at the end of the scroll. This way, the fading effect remains in place, and the scrollView seems to disappear.

+1
source

You can do it beautifully using layer masking:

  • create a mask with the appropriate alpha gradient
  • add mask to table
  • implement a scroll delegate to move the mask to the current viewport when the table scrolls.

Everything is explained very well here: http://www.cocoanetics.com/2011/08/adding-fading-gradients-to-uitableview/

+1
source

Could you implement a footer (or last cell) that has matching alpha fading to give you the effect you're looking for?

0
source

Source: https://habr.com/ru/post/1410946/


All Articles