Iphone 在iOS中,如何在谷歌地图中追踪刷卡距离?
我有一个使用谷歌地图SDK的应用程序。 如果用户正在地图视图控制器上进行任意滑动,比如说100英里,那么我想将用户带回其当前位置 如何在地图中实现此功能 如何追踪在屏幕上移动地图100英里的狂扫 如何知道轻击的强度?根据缩放级别,滑动距离当前位置有多少英里Iphone 在iOS中,如何在谷歌地图中追踪刷卡距离?,iphone,ios,xcode,ipad,google-maps-sdk-ios,Iphone,Ios,Xcode,Ipad,Google Maps Sdk Ios,我有一个使用谷歌地图SDK的应用程序。 如果用户正在地图视图控制器上进行任意滑动,比如说100英里,那么我想将用户带回其当前位置 如何在地图中实现此功能 如何追踪在屏幕上移动地图100英里的狂扫 如何知道轻击的强度?根据缩放级别,滑动距离当前位置有多少英里 提前谢谢 你所说的狂扫是什么意思?一扫地图100英里?如果是,您可以将UIPangestureRecognitor添加到地图视图中 UIPanGestureRecognizer *panRecognizer = [[UIPanGestureR
提前谢谢 你所说的狂扫是什么意思?一扫地图100英里?如果是,您可以将UIPangestureRecognitor添加到地图视图中
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:aGMSMapView action:@selector(pan:)];
[aGMSMapView addGestureRecognizer:panRecognizer];
并实现了一种检测平移手势状态是否结束的方法。如果是,请检查地图视图的中心以确定移动的距离
-(void)pan:(UIPanGestureRecognizer*) gestureRecognizer
{
if(gestureRecognizer.state == UIGestureRecognizerStateEnded)
{
//get the center of map view, and calculate distance
CGPoint *point = aGMSMapView.center;
CLLocationCoordinate2D coor = [aGMSMapView.projection coordinateForPoint:point];
CLLocation *mapCenter = [[CLLocation alloc]initWithLatitude:coor.latitude longitude:coor.longitude];
CLLocationDistance d = [mapCenter distanceFromLocation:currentLocation];
if (d>= 106900)
{
//move your map view and do whatever you want...
}
}
}
您使用的是谷歌地图iOS SDK还是苹果地图ie地图工具包?你已经用谷歌地图、mapkit和apple-maps标记了你的问题。你的问题在哪里?检测地图中心的变化,或者读取当前位置并将地图集中在那里?@SaxonDruce:我在使用谷歌地图。@AlexWien:如何追踪在屏幕上移动地图100英里的狂扫?是否有类似getMapCenter的内容?小心在地图上添加手势: