Я пишу код, чтобы изменить mkannotation штырькового изображения при прокрутке страницы .... но я теста не могу изменить это мой кодMKAnnotation булавка изображение не изменяется при прокрутке
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{
int pageNum = (int)(self.scroll.contentOffset.x/self.scroll.frame.size.width);
if(pageNum==0){
if([[annotation title]isEqualToString:@"place1"]){
myPin = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"place"];
myPin =[[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"place"];
myPin.image = [UIImage imageNamed:@"star.png"];
}
}
else if (pageNum==1){
if([[annotation title]isEqualToString:@"place2"]){
myPin = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"place"];
myPin =[[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"place"];
myPin.image = [UIImage imageNamed:@"star.png"];
}
}
else if (pageNum==3){
if([[annotation title]isEqualToString:@"place3"]){
myPin = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"place"];
myPin =[[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"place"];
myPin.image = [UIImage imageNamed:@"star.png"];
}
}
}