【发布时间】:2015-02-08 13:16:05
【问题描述】:
我用 UIImageView 构建了一个应用程序,我搜索了网络,但没有找到一个完整的解决方案,没有 UIScrollView 可以在我的视图中点击放大。
这是我现在拥有的,但效果不好:
有可能吗?如果有更好的方法,我希望你能帮助我。
在 viewDidLoad 中:
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired:2];
[imageViewForCrop addGestureRecognizer:doubleTap];
我的手柄双击方法:
- (void)handleDoubleTap:(UIGestureRecognizer *)gestureRecognizer
{
CGPoint tappedPoint = [gestureRecognizer locationInView:self.view];
CGFloat xCoordinate = tappedPoint.x;
CGFloat yCoordinate = tappedPoint.y;
// zoom in
[imageViewForCrop setFrame:CGRectMake( imageViewForCrop.frame.origin.x , imageViewForCrop.frame.origin.y , imageViewForCrop.frame.size.width +200, imageViewForCrop.frame.size.height+200)];
imageViewForCrop.center = CGPointMake(xCoordinate , yCoordinate);
}
【问题讨论】:
-
您想放大以查看图像的更多细节还是将其放大?
-
只是在用户点击的地方变大。
-
你想放大用户点击的点还是无论如何都放大?
-
想要在用户点击的地方放大。
标签: objective-c uiimageview uipangesturerecognizer