Note that there are some explanatory texts on larger screens.

plurals
  1. POMapKit doesn't show Blue Dot for Current Location
    text
    copied!<p>I am a newbie in MapKit for iPhone and tried to implement this, for some reason I can't see the current location blue dot, anyone else had this issue????</p> <pre><code>#import "DetailMapViewController.h" #import "mapAnnotations.h" @implementation DetailMapViewController @synthesize inStock; -(void)getlocation:(CLLocationCoordinate2D)loc { location = loc; } - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Street View"; mapView = [[MKMapView alloc] initWithFrame:self.view.bounds]; mapView.delegate=self; //MKCoordinateRegion region; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location, 5000, 5000); mapAnnotations *ann = [[mapAnnotations alloc] init]; ann.title = @""; ann.subtitle = @""; ann.coordinate = region.center; mapView.showsUserLocation = YES; [mapView addAnnotation:ann]; [mapView setRegion:region animated:TRUE]; [mapView regionThatFits:region]; [self.view insertSubview:mapView atIndex:0]; } - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;) annotation { MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"]; if (annotation == mapView.userLocation) { annView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"blueDot"]; if (annView != nil) { annView.annotation = annotation; } else { annView = [[[NSClassFromString(@"MKUserLocationView") alloc] initWithAnnotation:annotation reuseIdentifier:@"blueDot"] autorelease]; } } if([inStock isEqual:@"yes"]){ annView.pinColor = MKPinAnnotationColorGreen; } if([inStock isEqual:@"no"]){ annView.pinColor = MKPinAnnotationColorRed; } if([inStock isEqual:@"unknown"]){ UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"greyPin.png"]]; [annView addSubview:imageView]; } annView.animatesDrop=TRUE; annView.canShowCallout = YES; annView.calloutOffset = CGPointMake(-5, 5); return annView; } - (void)dealloc { [super dealloc]; } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload