ich Code schreiben mkannotation Stift Bild zu ändern, wenn Scroll-Seite .... aber ich werde Test kann es nicht ändern dies ist mein CodeMKAnnotation Stift Bild ändert sich nicht, wenn Scroll
-(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"];
}
}
}