开发者

iPhone: MKAnnotation show popup?

开发者 https://www.devze.com 2022-12-29 02:24 出处:网络
I have a MKMapView that has a pin than when pressed shows the annotation开发者_Python百科\'s title and subtitle.

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消