터치했을 때 MoreDetailViewController를 스택에 가져와야하는 세부 공개 표시기가있는 mapView가 있습니다. 현재 인스턴스 오류로 전송 된 인식 할 수없는 선택기와 충돌합니다.세부 공개 표시자가 접촉했을 때 Mapview 주석이 충돌 함
이 방법을 공개 표시기 프레스에서 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
호출하는 방법을 알아 내려고하고 있습니다. 여기
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
MKPinAnnotationView *mapPin = nil;
if(annotation != map.userLocation)
{
static NSString *defaultPinID = @"defaultPin";
mapPin = (MKPinAnnotationView *)[map dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (mapPin == nil)
{
mapPin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:defaultPinID];
mapPin.canShowCallout = YES;
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[disclosureButton addTarget:self action:@selector(prepareForSegue:) forControlEvents:UIControlEventTouchUpInside];
mapPin.rightCalloutAccessoryView = disclosureButton;
}
else
mapPin.annotation = annotation;
}
return mapPin;
}
가 호출하는 메소드입니다 : 여기
는 공개 표시와 함께지도 주석 코드입니다, 당신이 상세 뷰 컨트롤러의 두 종류가있는
MoreDetailViewController
// Do some customisation of our new view when a table item has been selected
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure we're referring to the correct segue
if ([[segue identifier] isEqualToString:@"ShowMoreInfo"]) {
// Get reference to the destination view controller
MoreDetailViewController *mdvc = [segue destinationViewController];
[mdvc setSelectedItemName:[NSString stringWithFormat:@"%@", placeName.text]];
[mdvc setSelectedItemAddress:[NSString stringWithFormat:@"%@", placeFormattedAddress.text]];
[mdvc setSelectedItemWeb:[NSString stringWithFormat:@"%@", placeWebsite.text]];
[mdvc setSelectedItemRating:[NSString stringWithFormat:@"%@", placeRating.text]];
// [mdvc setSelectedItemDistance:[NSString stringWithFormat:@"%@", placeDistance.text]];
}
}
다음은 오류입니다. *** 캐치되지 않은 예외 'NSInvalidArgumentException'으로 인해 응용 프로그램을 종료합니다. 이유 : '- [DetailViewController prepareForSegue :] : 인스턴스 0x81bbb30에 전송 된 인식 할 수없는 선택기' – hanumanDev