在iOS Objective C的UIScrollView中设置时如何捏谷歌地图
Posted
技术标签:
【中文标题】在iOS Objective C的UIScrollView中设置时如何捏谷歌地图【英文标题】:How to pinch google map when it set in UIScrollView in iOS Objective C 【发布时间】:2016-12-15 10:21:03 【问题描述】:我在 UIScrollView 的视图中设置了 Google Map。一切正常,但我无法捏我的地图。如何解决?
【问题讨论】:
【参考方案1】: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];
【讨论】:
首先我必须在 mapView 上添加手势? 手势添加到 UIScrollView 但不能添加到 self.mView(我的地图视图)。以上是关于在iOS Objective C的UIScrollView中设置时如何捏谷歌地图的主要内容,如果未能解决你的问题,请参考以下文章
如何在ios Objective C中传递PayTm事务的GET请求