小编Ami*_*hah的帖子

MKAnnotation没有在MKMapView上显示标注

我有一个MKMapView,我正在添加这样的注释:

for (NSDictionary *tmp in response)
{
    NSDictionary *places = [tmp objectForKey:@"place"];
    NSDictionary *location = [places objectForKey:@"location"];
    NSLog(@"long: %@ Lat:%@",[location objectForKey:@"longitude"], [location objectForKey:@"latitude"]);

    float longitude = [[location objectForKey:@"longitude"] floatValue];
    float latitude = [[location objectForKey:@"latitude"] floatValue];


    CLLocationCoordinate2D locationco = {latitude,longitude};
    NSString *titleString = [tmp objectForKey:@"name"];

    Place *pin = [[Place alloc] init];
    pin.coordinate = locationco;
    pin.title = titleString;
    pin.subtitle = @"A Location";

    //NSArray *annots = [[NSArray alloc] initWithObjects:pin, nil];
    //[map addAnnotations:annots];
    [map addAnnotation:pin];
    [[map viewForAnnotation:pin] setCanShowCallout:YES];
}
Run Code Online (Sandbox Code Playgroud)

MKAnnotation的显示在地图上罚款,我可以选择它们,但是没有出现标注泡沫.我知道他们正在被选中 …

objective-c mkmapview ios automatic-ref-counting

14
推荐指数
2
解决办法
1万
查看次数