I can't for the life of me figure out how to create such an effect on a UIView that has dynamic height. I want to have the top have a "torn paper" style edge, but the view can be of dynamic height, so when I set the torn paper mask at the top, it gets stretched the full length of the view.
Can I say, "stick to the top", or perhaps designate a portion that is supposed to stretch? Preferably with layers but iOS 8's maskView
property works too.
You can set the frame of the layer's mask to anything you want. So that's one way to position it.
Or you could (probably, I haven't tried yet) use a stretchable image view as the mask (- resizableImageWithCapInsets:resizingMode:). That should keep the torn paper edge from stretching.