I want to implement a magnifier exactly like the one is shown when an UITextView is long pressed.
I got the idea from here: iPhone, reproduce the magnifier effect
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