在我的viewWillAppear中我有一个视图
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
[point setCoordinate:(myLocation)];
[point setTitle:@"Here it is!"];
[mapView addAnnotation:point];
[mapView setRegion:adjustedRegion animated:YES]; 如我所愿,这会将点添加到地图中。但是,我必须点击它才能看到标注。
我如何才能让它默认显示标注?
我试着在后面添加这个:[self.mapView selectAnnotation:annotation animated:YES];
但它似乎不起作用。我必须使用真正的注解而不是MKPointAnnotation来做这件事吗?
发布于 2012-03-02 03:29:17
您将批注命名为point而不是annotation
[mapView selectAnnotation:point animated:YES];这种事我们大家都是难免的。
发布于 2016-12-23 14:24:19
swift 3
在addAnnotation之后提醒此操作。
mapView.addAnnotation(point)
mapView.selectAnnotation(point, animated: true)https://stackoverflow.com/questions/9520205
复制相似问题