views:

474

answers:

1

I need to mask a whole animation that takes place in a UIImageView. I tried subclassing the UIImageView and doing the masking in its drawRect call but that doesn't get called on every frame of the animation as I expected (it doesn't get called at all actually) even though the animation plays fine.

Anyone has any experience on this?

+1  A: 

Since the CIFilter public API is missing on iPhone OS, there's no way to do compositing using UIView or CALayer.

This means that the answer is: You cannot mask the contents of UIImageView, animated or not.

I've filed a radar bug request because I feel that the addition of the CIFilter API would be a great enhancement to Cocoa Touch and expand the possibilities of UIView/CALayer based UI design a lot. At the moment, if you want to do compositing on the iPhone, you have to use Quartz (slow) or OpenGL (doing everything yourself).

If you agree on the usefulness of CIFilters for iPhone OS, please consider filing a request on radar. The more requests, the sooner Apple will care about it.

Nikolai Ruhe
Thanks Nikolai for confirming my fears. To workaround it, I subclassed a UIView and did the animation using a Timer. Now it works, but the performance is terrible.
Dimitris