Skip to content

Circle with distance to showing in Center of MAPView.

License

Notifications You must be signed in to change notification settings

pawankv89/MKCircle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MKCircle

Find 500m Range of your current location


Added Some screens here.

[] [] []

Usage


You can add this method in your UICollectionView.

- (void) loadMapView
{
    CLLocationCoordinate2D objCoor2D = {.latitude = latitude_UserLocation, .longitude = longitude_UserLocation};
    
    //Remove Old OverLay on MAP View
    for (id overlay in objMapView.overlays) {
        if([overlay isKindOfClass:[MKCircle class]]) {
            //Removing past layouts from MapView
            [objMapView removeOverlay:(MKCircle *)overlay];
        }
    }
    
    
    [objMapView setShowsUserLocation:YES];
    [objMapView setDelegate:self ];
    MKCircle *circle = [MKCircle circleWithCenterCoordinate:objCoor2D radius:distance];
    [objMapView addOverlay:circle];
    
    //Set Region On MAP View
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(objCoor2D, distance*2,distance*2);
    [objMapView setRegion:region animated:YES];
}

Add MKMapView Delegate

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay
{
    if([overlay isKindOfClass:[MKCircle class]]) {
        
        MKCircleRenderer *circleView = [[MKCircleRenderer alloc] initWithOverlay:overlay];
        circleView.strokeColor = [UIColor blueColor];
        circleView.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.4];
        circleView.lineWidth = 1.0f;
        return circleView;
    }
    return nil;
}

License

This code is distributed under the terms and conditions of the MIT license.

Change-log

A brief summary of each this release can be found in the CHANGELOG.

About

Circle with distance to showing in Center of MAPView.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published