0
속성 (NameTable 및 ID)을 부여한 사용자 지정 주석이 많이 있습니다. AddAnnotation 전에이 속성을 설정했지만 위임 메서드의 이러한 속성은 더 이상 볼 수 없습니다. 데이터베이스에서 가져온 테이블 요소와 관련된 여러 주석이 있습니다. 대리자 메서드에서 어떻게 보이게 할 수 있습니까? 사용자 정의 주석 속성을 대리자 메서드에 표시 할 수 없습니다.
- (void)viewDidLoad
{
//......
for(int i=0; i<6; i++){ //loop for create multiple annotations
AnnotationCustom *annotationIcone =[[AnnotationCustom alloc]initWithCoordinates:coord
title:self.myTable.title subTitle:self.myTable.address];
annotationIcone.nameTable = [NSString stringWithFormat:@"%@", self.myTableName];
annotationIcone.ID = i+1;
[self.mapView addAnnotation: annotationIcone;
//.....
}
그러나 위임 방법에
:(MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id
<MKAnnotation>)annotation
{
NSLog(@"The name of table is:@"%@", annotation.nameTable);
//property 'nameTable' not found on object of type '_strong id <MKAnnotation>
NSLog (@The name of table is:@%@", annotation.ID);
//property 'ID' not found on object of type '_strong id <MKAnnotation>
//......
}
또 다른 방법은 : viewForAnnotation에서
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{
NSLog(@"The name of table is %@", self.myTableName);
// here I get the name of last table open and not the name of table selected
}
감사합니다. –
매우 간단하면서도 크게 감사하겠습니다! – CampbellGolf