Hi!

I have the exact same problem, I use a MapDelegate:

public class MapDelegate : MKMapViewDelegate
        {

                protected string _annotationIdentifier = "BasicAnnotation";
                public override MKAnnotationView GetViewForAnnotation 
(MKMapView mapView,
NSObject annotation)
                {
                        
                        //---- try and dequeue the annotation view 
                        MKAnnotationView annotationView = 
mapView.DequeueReusableAnnotation
(this._annotationIdentifier);
                        //---- if we couldn't dequeue one, create a new one 
                        if (annotationView == null) {
                                annotationView = new MKPinAnnotationView 
(annotation,
this._annotationIdentifier);
                        } else { //---- if we did dequeue one for reuse, assign 
the annotation to
it 
                                annotationView.Annotation = annotation;
                        }
                        
                        //---- configure our annotation view properties 
                        annotationView.CanShowCallout = true;
                        (annotationView as MKPinAnnotationView).AnimatesDrop = 
false; 
                        
                        if (!(annotation is MonoTouch.MapKit.MKUserLocation)) {
                                
                                (annotationView as MKPinAnnotationView).Image = 
new UIImage
(String.Format ("Images/{0}.png", ((TrainAnnotation)annotation).Icon));
                                
                        } else {
                                UILabel label = new UILabel ();
                                label.Text = "Test";
                                
                                (annotationView as 
MKPinAnnotationView).AddSubview (label);
                                (annotationView as 
MKPinAnnotationView).PinColor =
MKPinAnnotationColor.Green;
                                annotationView.Selected = true;
                        }
                                
                        return annotationView;
                }

Nothing special, but every time I change the MapType, the default red pins
return! Did you ever resolve the problem? or is there anyone else with this
problem?

Thanks,

Ramon


fsantanac wrote
> 
> Hi, i have a mapkit with GetViewForAnnotation for set image to my
> annotation, work fine. My problem is when the user change maptype via
> button, my images loose and show the default pin image in my map.
> How can do that my images show again?
> 
> Thanks an sorry for my english
> 

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Change-MapType-loose-my-image-annotation-tp3803972p4533464.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to