0
한번 클릭하면 MapView에서 특수 효과의 부제를 설정하는 데 어려움을 겪고 있습니다.annotation의 부제목 업데이트
하는 .m :
MKCoordinateRegion England = { {0.0, 0.0} , {0.0, 0.0} };
England.center.latitude = 51.50063;
England.center.longitude = -0.124629;
England.span.longitudeDelta = 100.0f;
England.span.latitudeDelta = 100.0f;
[mapView setRegion:England animated:YES];
Annotation *ann1 = [[Annotation alloc] init];
ann1.title = @"England";
ann1.subtitle = @"subtitle";
ann1.coordinate = England.center;
[mapView addAnnotation:ann1];
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation: (id<MKAnnotation>)annotation {
MKPinAnnotationView *MyPin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"]; MyPin.pinColor = MKPinAnnotationColorPurple;
UIButton *advertButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[advertButton addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
MyPin.rightCalloutAccessoryView = advertButton;
MyPin.draggable = NO;
MyPin.highlighted = YES;
MyPin.animatesDrop = TRUE;
MyPin.canShowCallout = YES;
return MyPin;
}
- (void)mapView:(MKMapView *)mapView1 didSelectAnnotationView:(MKAnnotationView *)view
{
id<MKAnnotation> selectedAnn = [mapView.selectedAnnotations objectAtIndex:0];
country_title = selectedAnn.title;
selectedAnn.subtitle = @"NEW SUBTITLE";
}
어떻게 주석을 클릭하고 나면 내가 자막을 설정합니까? 내가 그것을 클릭하면 mysql에서 일부 행을 얻을 수 있기 때문에 나는 그런 식으로 할 wan't.하지만 특정 주석에 대한 부제를 업데이 트하는 방법을 모르겠다?
미리 감사드립니다. :)
안녕 Mohith 도움이! 빠른 답장을 보내 주셔서 감사합니다. 불행히도 나는 그 줄을 어디에 둘 것인가에 의아해하고있다. 나는 이미 내 didSelectAnnotationView에서 그것을 가지고있다. id selectedAnn = [mapView.selectedAnnotations objectAtIndex : 0]; ... 나는 매우 새로운데 :( –
전체 내용을 내 발췌 문장으로 바꾼다 – Mohith
나는 당신에게 발췌를 시도했지만, 새 주석을 특정 위치에 넣을 수 있습니다. 내가 클릭 한 주석이 아닌 경우 어떻게해야합니까? NSString 속성을 설정하고 다음과 같이 말할 수는 없습니다. id selectedAnn = view.annotation country_title = selectedAnn.title ; if ([country_title isEqualToString : @ "미국"]) { subtitle_USA = @ "NEW SUBTITLE" } –