【发布时间】:2016-12-15 10:21:03
【问题描述】:
我在 UIScrollView 的视图中设置了 Google Map。一切正常,但我无法捏我的地图。如何解决?
【问题讨论】:
标签: ios objective-c xcode google-maps uiscrollview
我在 UIScrollView 的视图中设置了 Google Map。一切正常,但我无法捏我的地图。如何解决?
【问题讨论】:
标签: ios objective-c xcode google-maps uiscrollview
Salaam Reza jaan.
在你的情况下,你可以使用这样的东西。干杯。
编辑:这是一种更好的方法。 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];
}
}
【讨论】: