[英]How to pinch google map when it set in UIScrollView in iOS Objective C
I set Google Map in view in UIScrollView . 我在UIScrollView的视图中设置了Google Map 。 everything OK but i can not pinch my map.
一切都很好,但我不能捏我的地图。 How to fix it?
如何解决?
Salaam Reza jaan. 萨拉姆(Salaam Reza)
In your case you can use something like this. 在您的情况下,您可以使用类似这样的方法。 Cheers.
干杯。
Edit: this is a better way to do it. 编辑:这是一种更好的方法。 Behbakht shid, direh inja :P
Behbakht shid,direh inja:P
- (void) scaleSelfWith:(UIPinchGestureRecognizer *)gestureRecognizer{
if ([gestureRecognizer numberOfTouches] >1) {
//getting width and height between gestureCenter and one of my finger
float x = [gestureRecognizer locationInView:self].x - [gestureRecognizer locationOfTouch:1 inView:self].x;
if (x<0) {
x *= -1;
}
float y = [gestureRecognizer locationInView:self].y - [gestureRecognizer locationOfTouch:1 inView:self].y;
if (y<0) {
y *= -1;
}
//set Border
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
xDis = self.bounds.size.width - x*2;
yDis = self.bounds.size.height - y*2;
}
//double size cause x and y is just the way from the middle to my finger
float width = x*2+xDis;
if (width < 1) {
width = 1;
}
float height = y*2+yDis;
if (height < 1) {
height = 1;
}
self.bounds = CGRectMake(self.bounds.origin.x , self.bounds.origin.y , width, height);
[gestureRecognizer setScale:1];
[[self layer] setBorderWidth:2.f];
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.