0

I'm looking for a way to swipe image filters over top of a still image.

Mainly the base image stays in place, and the filters slide in over top when you swipe left or right.

Right now I have a base UIImageView and a Collection View over top of it which in theory would hold the filters (texture and gradient images).

I've read that UIImageViews and UIViews can't be live composited on top of each other, and that you must make the image before displaying it. So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?

Code examples are nice, but a high level description on how to approach this would be helpful.

The app Spark has this functionality for videos, I'm looking to do something similar for photos.

Dave Chenell
  • 601
  • 1
  • 8
  • 23
  • I have posted solution here: http://stackoverflow.com/a/26021647/3324388 and I would love to hear how this compares to yours! – Aggressor Sep 24 '14 at 16:14

1 Answers1

1

So I can pre-make the image beforehand in code, then can I wipe-reveal the filter image to get the same effect? Using masks?

Yes, but no need for a mask. Pre-make the filtered image and put it in an image view. Let's say this filtered effect is to be swiped in from the left. Then make the image view's content mode be Left, and put it at the left of the real image, with width zero. As the swipe happens, animate the width of the image view to the width of the image. This will cause the filtered image to be revealed from the left side.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • 1
    Also note that in iOS 7 there's the whole new snapshotting API which makes it really easy to take a snapshot of a whole view and its subviews. I use this and the technique I just described to make a modal view rise from the bottom of the screen in such a way that it *looks* like it is blurring what's behind it. But in fact the blurred image of what's behind it is a pre made image gradually being revealed by expanding the height of the image view that holds it. – matt Dec 12 '13 at 19:32
  • This was a good theory, but it didn't work out for me. I ended up using core animation and wiping the image on that way. Thanks though! – Dave Chenell Dec 17 '13 at 00:54