views:

21

answers:

0

Hi, I want to implement a magnifier exactly like the one is shown when an UITextView is long pressed.

I got the idea from here: http://stackoverflow.com/questions/2030730/iphone-reproduce-the-magnifier-effect/2030846#2030846

But I am working only with CALayers not UIViews, hence I don't have a drawRect method to write in. I wonder where should I write this? inside display method? or drawInContext: method?

How can I efficiently raster all the layers from the original view? (the view to be magnified) is it really a good idea to do:

UIGraphicsBeginImageContext(magnifyView.bounds.size); //magnifyView is the view to be magnified
[magnifyView.layer renderInContext:UIGraphicsGetCurrentContext()]; 
_cache = UIGraphicsGetImageFromCurrentImageContext(); //_cache is an UIImage
UIGraphicsEndImageContext();

and then get the portion I need from this UIImage's CGImageRef?

Thanks