简体   繁体   English

iOS6 MKMapView自定义注释不呈现

[英]iOS6 MKMapView custom annotations doesn't render

My application worked correctly in iOS5, after update to iOS6 I have trouble rendering my own annotations on MKMapView . 我的应用程序在iOS5中正常工作,在更新到iOS6后我无法在MKMapView上呈现我自己的注释。 I found, that (MKAnnotationView *)mapView:(MKMapView *)_mapView viewForAnnotation:(id<MKAnnotation>)annotation function isn't called. 我发现,那个(MKAnnotationView *)mapView:(MKMapView *)_mapView viewForAnnotation:(id<MKAnnotation>)annotation没有调用(MKAnnotationView *)mapView:(MKMapView *)_mapView viewForAnnotation:(id<MKAnnotation>)annotation函数。 So I see only default red pins on map. 所以我在地图上只看到默认的红色别针。 Here is my initialization code: 这是我的初始化代码:

[self setMapView:[[MKMapView alloc] initWithFrame:CGRectMake(FRAME_X, FRAME_Y, FRAME_FULL_WIDTH, FRAME_HEIGTH)]];
[self.mapView addAnnotations:self.annotations];
[self.mapView setDelegate:self];
[self.view addSubview:self.mapView];

phix23 solution was correct. phix23解决方案是正确的。 I needed to set delegate before annotations 我需要在注释之前设置委托

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM