MKMapView MKAnnotationView ВЫПУСК?
У меня есть вид карты с контактами, который, когда пользователь выбирает контакт, переходит на подробный экран для этого контакта. У меня также есть табличное представление, что, когда пользователь выбирает элемент, он переходит к подробному виду того же типа.
Я добавляю несколько выводов в mapview через массив. Я добавил кнопку для просмотра аксессуаров,
Вот в чем проблема ...
когда я нажимаю кнопку выбора вывода, он выводит его в подробный вид для другого вывода. Но в табличном представлении он все еще работает нормально .. кто-нибудь, пожалуйста, помогите мне с этим ...?
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
MKPinAnnotationView *newAnnotation = nil;
if([annotation.title isEqualToString:@"You are here."])
{
newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenpin"];
newAnnotation.pinColor = MKPinAnnotationColorGreen;
}
else
{
newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"redpin"];
newAnnotation.pinColor = MKPinAnnotationColorRed;
UIButton *pinButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinButton.tag = indexvar;
[newAnnotation addSubview:pinButton];
newAnnotation.canShowCallout = YES;
newAnnotation.rightCalloutAccessoryView = pinButton;
newAnnotation.calloutOffset = CGPointMake(-5, 5);
indexvar++;
return newAnnotation;
[pinButton release];
}
newAnnotation.animatesDrop = YES;
newAnnotation.canShowCallout = YES;
return newAnnotation;
}
- (void)mapView:(MKMapView *)wikiMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
NSInteger selectedIndex = ((UIButton *)control).tag;
NSLog(@"Property Index : %d ",selectedIndex);
DetailView = [[PropertyDetails alloc] initWithNibName:@"PropertyDetails" bundle:nil];
DetailView.propertyReference = [PropertyReferenceArr objectAtIndex:selectedIndex];
DetailView.propertyTitle = [propertyTitlesArr objectAtIndex:selectedIndex];
DetailView.propertyPrice = [propertyPriceArr objectAtIndex:selectedIndex];
DetailView.propertyBedrooms = [propertyBedroomsArr objectAtIndex:selectedIndex];
DetailView.propertyLatitude = [propertyLatitudesArr objectAtIndex:selectedIndex];
DetailView.propertyLongitude = [propertyLongitudesArr objectAtIndex:selectedIndex];
DetailView.propertyDefaultImage = [PropertyImageArr objectAtIndex:selectedIndex];
DetailView.propertyStatusId = [PropertyStatusArr objectAtIndex:selectedIndex];
[self.navigationController pushViewController:DetailView animated:YES];
[DetailView release];
}