views:

39

answers:

1

Hi all,

I am implementing a MKMapView based application. In that I am using a custom image instead of displaying a pin by using MKAnnotationView.Image property. It is working fine. But I had a problem with pin display it is showing in the ocean. When I used default pin it works fine. I don't know what is the problem. Can you guys please suggest me on this?. please help me.

cityAnnotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CityAnnotation"] autorelease]; 
//cityAnnotationView.image = [[UIImage imageNamed:@"city_pin.png"] stretchableImageWithLeftCapWidth:100 topCapHeight:10]; 
cityAnnotationView.image = [UIImage imageNamed:@"city_pin.png"];
cityAnnotationView.backgroundColor=[UIColor clearColor]; 
cityAnnotationView.annotation = annotation;
cityAnnotationView.canShowCallout = NO; 
cityAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

Thanks in advance. Sekhar.

A: 

You need to also set the annotation location. The default (0,0) location is indeed in the ocean ;)

Paul Ardeleanu