bluekurk
bluekurk

Reputation: 21

MKMapView showsUserLocation default is gray dot, not blue one

I added a MKMapView to the view controller, set showsUserLocation to YES:

MKMapView *mapView =[[MKMapView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT/2)];
mapView.delegate=self;
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
mapView.showsUserLocation = YES;
[self.view addSubview:mapView];

and implemented the protocol:

- (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnnotation>)annotation{
    MyAnnotation * myannotation=(MyAnnotation * )annotation;
    if(annotation != aMapView.userLocation)
    {
        // create a customized MKAnnotationView and return it. blabla
        return annView;
    }
    else
    {
        [aMapView.userLocation setTitle:NSLocalizedString(@"i_am_here",nil)];
    }
    return nil;
}

It shows a gray dot inside a white circle. The gray part is animating while the user location updates. What I expect is a blue dot, just like the one in the iOS Map app by Apple, and I do not want to customize the view for userLocation (animations...)

Is there any simple settings to change the dot color from gray to blue?

I am testing it on iPhone 5c, 7.1.1; Xcode 5.1.1

The code should work well before on iOS 5 and 6.

Upvotes: 1

Views: 2354

Answers (2)

Guilherme Rangel
Guilherme Rangel

Reputation: 87

You can use:

mapView.tintColor = .red

Upvotes: 0

debug
debug

Reputation: 151

Take a look at your mapview tintcolor.

For exemple if self.mapview.tintColor = [UIColor grayColor]; the dot color is gray, set it to blue color and it return to blue.

Upvotes: 9

Related Questions