开发者

How to enlarge/blow up/zoom a certain part of a UIImageView on iPhone?

开发者 https://www.devze.com 2023-02-09 23:28 出处:网络
I have a magnifying glass as 开发者_JAVA百科a UIImageView subview of a UIView.I want to enlarge the part of the UIView that the magnifying glass is on.I can\'t figure out how to enlarge a certain part

I have a magnifying glass as 开发者_JAVA百科a UIImageView subview of a UIView. I want to enlarge the part of the UIView that the magnifying glass is on. I can't figure out how to enlarge a certain part of the view. I assume it has to be a rectangle and not a circle? How could I blow it up? I don't have much CA experience so a shove in the right direction would help.


If you want to zoom a static image, then you can do this:

Make the magnifyingView (UIView) have a sub-view that's a UIImageView. The UIImageView has the same image that's being magnified, but much larger. Have the magnifyingView clip to bounds set. Then, as the UIView is moved by the user dragging/touching, the subview is moved in relation to that to create a magnify effect.

I'd have to look up how to magnify dynamic content myself.


I am about to do the same thing. Here is an example of how to capture a view in an image. You can then zoom in the image in the bubble:

UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
self.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0

精彩评论

暂无评论...
验证码 换一张
取 消