I have a MKMapView that has a pin than when pressed shows the annotation开发者_Python百科's title and subtitle.
Is there a way in code to have this text shown automatically so the user does not need to click it?
If I have many pins, can they all appear as well?
You need to use the selectAnnotation message on MKMapView:
- (void)selectAnnotation:(id <MKAnnotation>)annotation animated:(BOOL)animated
Selects the specified annotation and displays a callout view for it.
This might help:
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
If your MKMapView is called mapView and your MKAnnotation is called myAnnotation then this will work:
[mapView selectAnnotation:myAnnotation animated:YES];
精彩评论