开发者

iphone - Hide the annotation view in map view

In my view, i've nav bar at the top and remaining view is filled with map view. My Map view has pins and on click of pin, it will show annotations also. In the top right nav bar i've a b开发者_如何学Cutton and on click of it, i want to remove the annotation view that popped up. (what ever annotation view is there, i want to remove from the view). Can some one tell me how to do it.

The simple task we can do is to send some touch event to the map view which will hide it..... am i right. how to do it?


To hide the callout all you need to do is deselect the selected annotation. You do that by using...

- (void)deselectAnnotation:(id < MKAnnotation >)annotation animated:(BOOL)animated

For example:

[mapView deselectAnnotation:[mapView.selectedAnnotations objectAtIndex:0] animated:YES];

assuming mapView is what you named your MKMapView instance.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜