【问题标题】:how to show markers only in gmscircle region otherwise hide in ios如何仅在 gmscircle 区域中显示标记,否则隐藏在 ios 中
【发布时间】:2014-07-15 04:50:15
【问题描述】:

如何仅在 GMSCirle 区域显示标记,否则隐藏在 iOS 中,我使用谷歌地图创建了 GMSCirle,现在我想仅在 GMSCirle 区域显示标记,否则隐藏标记。

这是我的代码:

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;

如果有任何想法可以理解,我会很努力,提前谢谢。

我只是想知道如何仅在 iOS 的特定区域显示标记

【问题讨论】:

    标签: ios google-maps gmsmapview


    【解决方案1】:

    您可以使用以下简单的想法。

    -(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;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-01
      • 1970-01-01
      • 2019-06-04
      相关资源
      最近更新 更多