I have a UIScrollView that contains other subviews that are partially drawn outside of the scrollview. These views extend vertically above the scrollview. Is it possible to only allow the subviews to be drawn outside the top of the scrollview, and not allow them drawn outside of the left and right sides of the scrollview?
What is happening, is that when I manually scroll left and right, the subviews are being drawn outside of the scrollview because of the content size. Once the subview's are scroll outside of the scrollview's frame, I want to clip the subviews.
Any suggestions or is this possible?
Here's how I implemented Max Chuquimia's nice solution in Objective-C:
Any part of the parent view or its children which is not covered by black pixels in the mask will be clipped.
In this snippet, we clip left and right, but leave 100 points on top and below the parent view for children to overflow. (the mask is bigger than the parent view)