iphone中的缩放和点击手势
如何在不使用scrollView的情况下,在UIImageView中添加缩放(使用挤压手势)和触摸(使用轻触手势)?可能吗?我使用了UIImageView和UIScrollView。这是我放在viewDidLoad上的代码iphone中的缩放和点击手势,iphone,objective-c,Iphone,Objective C,如何在不使用scrollView的情况下,在UIImageView中添加缩放(使用挤压手势)和触摸(使用轻触手势)?可能吗?我使用了UIImageView和UIScrollView。这是我放在viewDidLoad上的代码 [scrollView addSubview:imgView]; scrollView.minimumZoomScale = 1.0; scrollView.maximumZoomScale = 12.0; scrollView.delegat
[scrollView addSubview:imgView];
scrollView.minimumZoomScale = 1.0;
scrollView.maximumZoomScale = 12.0;
scrollView.delegate = self;
[scrollView setZoomScale:scrollView.userInteractionEnabled];
[[self view] addSubview:imgView];
[scrollView bringSubviewToFront:self.view];
//gesture recognizer
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
[imgView addGestureRecognizer:tap];
如果我尝试这段代码。可以使用Tap,但缩放不起作用,因为Imageview隐藏了scrollview。有没有办法,如何在UIImageview上同时添加缩放和触摸功能
谢谢。可以在uiimage view上添加缩放和点击手势,请看我在网上找到的。这将帮助您完成所需的操作。
喜欢编码;) @Alok.我还有一个问题。问题是我的应用程序中有UIView(类似网格)。当我缩放ImageView时,栅格也会放大。我不想那样。我的意思是当我缩放ImageView时,子视图不应该被缩放。有什么想法吗?我想你必须只在imageView上应用所有的缩放效果我的意思是只将手势连接到imageView