Hi I am using a custom annotation in replacement of the blue GPS position dot. I have added it to the map like so in the viewForAnnotation. OurLocAnnotation class conforms to MKAnnotation delegate.
//Custom location view
if([annotation isKindOfClass:[OurLocAnnotation class]]) {
static NSString *identifier = @"currentLocation";
SVPulsingAnnotationView *pulsingView = (SVPulsingAnnotationView *)[self.recycleMap dequeueReusableAnnotationViewWithIdentifier:identifier];
if(pulsingView == nil) {
pulsingView = [[SVPulsingAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
pulsingView.annotationColor = [UIColor colorWithRed:0.678431 green:0 blue:0 alpha:1];
pulsingView.canShowCallout = YES;
}
return pulsingView;
}
Show user location is set to NO as per this link: Previous stackoverflow question and start updating location is called from viewDidLoad
The problem I have is the annotation is not showing do I need to move around for it to kick in and update my position or can I set its state on load i.e show the annotation and then have it update the annotation to my location? If I give the annotation hardcoded coordinate values it shows but I don't want that I want it based on my location?
- (void) locationManager:(CLLocationManager*) manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation
{
if (ourLocAnn == nil)
{
self.ourLocAnn = [[OurLocAnnotation alloc] init];
ourLocAnn.title = @"I am here";
ourLocAnn.coordinate = newLocation.coordinate;
[recycleMap addAnnotation:ourLocAnn];
}
else
{
ourLocAnn.coordinate = newLocation.coordinate;
}
UPDATE: I am stupid I can show my location like the below by asking the location manager for my position. I have just got to hope my location will update when I move....
ourLocAnn = [[OurLocAnnotation alloc]init];
ourLocAnn.coordinate = clController.locMgr.location.coordinate;
[recycleMap addAnnotation:ourLocAnn];