sayguh sayguh - 2 years ago 195
iOS Question

MKPointAnnotation - Default show title and animated?

In my viewWillAppear for a view I have

MKPointAnnotation *point = [[MKPointAnnotation alloc] init];

[point setCoordinate:(myLocation)];
[point setTitle:@"Here it is!"];

[mapView addAnnotation:point];

[mapView setRegion:adjustedRegion animated:YES];

This adds the point to the map as I intend. However I have to tap it in order to see the callout.

How can I have it show the callout by default?

I tried adding this right after:
[self.mapView selectAnnotation:annotation animated:YES];

But it didn't seem to work... do I have to use a real annotation and not a MKPointAnnotation to do this?

Answer Source

You named your annotation point not annotation:

 [mapView selectAnnotation:point animated:YES];

It happens to the best of us.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download