MKAnnotation显示但没有做任何事情

时间:2014-09-22 21:54:30

标签: ios mkmapview

我在地图上添加了一些引脚,但是当我点击它们时,我看不到要显示的标题。

我已设置MKMapViewDelegate并将其拖至自己。这是我的代码。

-(void) setMapPoints:(NSMutableArray*)array
{
    for(int x = 0; x < array.count; x++)
    {
        ListEntry* entry = [array objectAtIndex:x];

        CLLocationCoordinate2D coordinate;
        coordinate.latitude = entry.latitude;
        coordinate.longitude = entry.longitude;

        NSString* name = entry.title;
        NSString* description = entry.address;

        MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
        annotation.coordinate = coordinate;
        annotation.title = name;
        [self.mainMap addAnnotation:annotation];
    }

  }

# pragma mark - mkanottationview delegate

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
NSLog(@"Annotation added");
    MKPinAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Attraction"];
    annotationView.canShowCallout = YES;
    annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    //annotationView.image = [UIImage imageNamed:@"driveme"];
    return annotationView;
}

打印已添加注释的消息但是当点击该针时,我看不到带有标题的气泡。

我想念什么?代表再次被设置为自我。

我在IOS 7上试试。

0 个答案:

没有答案
相关问题