Reputation: 2550
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?
Upvotes: 6
Views: 7532
Reputation: 990
swift 3
reminder this action after the addAnnotation.
mapView.addAnnotation(point)
mapView.selectAnnotation(point, animated: true)
Upvotes: 0
Reputation: 9933
You named your annotation point
not annotation
:
[mapView selectAnnotation:point animated:YES];
It happens to the best of us.
Upvotes: 15