如何仅在gmscircle区域显示标记,否则隐藏在ios中 [英] how to show markers only in gmscircle region otherwise hide in ios
本文介绍了如何仅在gmscircle区域显示标记,否则隐藏在ios中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何仅在 GMSCirle
区域中显示标记,否则隐藏在iOS中,我已经使用Google Maps创建了 GMSCirle
现在我只想在 GMSCirle
区域显示标记,否则就隐藏标记。
how to show markers only in GMSCirle
region otherwise hide in iOS , I have created GMSCirle
using google maps, now I wanna display markers only on the region of GMSCirle
otherwise hide markers.
这里是我的代码:
GMSMarker *centerPoint=[GMSMarker markerWithPosition:CLLocationCoordinate2DMake(16.301687, 80.419235)];
centerPoint.icon=[UIImage imageNamed:@"PinImage.png"];
circ.fillColor = [UIColor colorWithRed:0.25 green:0 blue:0 alpha:0.05];
circ.strokeColor = [UIColor blackColor];
circ.strokeWidth = 5;
circ.tappable=true;
circ.map = mapView_;
mapView_.settings.myLocationButton=YES;
mapView_.settings.zoomGestures=YES;
mapView_.settings.zoomGestures=YES;
mapView_.settings.compassButton=YES;
mapView_.settings.rotateGestures=YES;
mapView_.settings.scrollGestures=YES;
mapView_.settings.tiltGestures=YES;
mapView_.myLocationEnabled=YES;
如果有任何想法是可以理解的,我就会挣扎很多,谢谢。
I struggled a lot if any idea would be appreciable , Thanks in advance.
只是我想知道如何在iOS中的特定区域显示标记
Simply i just wanna know how to display markers only on particular region in iOS
推荐答案
您可以使用以下简单的想法。
You can use following simple idea for it.
-(BOOL) checkMarker:(CLLocation*)locB
{
CLLocation *locA = [[CLLocation alloc]
initWithLatitude:24.590095
longitude:73.698256];
CLLocationDistance distance = [locA distanceFromLocation:locB];
NSLog(@"%f",distance);
if(distance <= RADIUS)
{
NSLog(@"You are in Circle ");
return true;
}
else
{
NSLog(@"You are not in circle");
return false;
}
}
这篇关于如何仅在gmscircle区域显示标记,否则隐藏在ios中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文