2014-07-15 58 views
0

如何僅在GMSCirle區域顯示標記,否則隱藏在iOS中,我創建了GMSCirle使用谷歌地圖,現在我只想在GMSCirle的區域顯示標記,否則隱藏標記。如何在gmscircle區域顯示標記,否則隱藏在ios

這裏是我的代碼:

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的

只顯示特定區域的標記

回答

4

您可以使用下面的簡單想法。

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