2013-06-01 1 views
1

Voici mon code:MKPinAnnotationView gauche bouton avec une image

 UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     UIButton* leftButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 

     [rightButton setTitle:[(myLocation*)annotation url] forState:UIControlStateApplication]; 
     [rightButton addTarget:self 
         action:@selector(showDetails:) 
       forControlEvents:UIControlEventTouchUpInside]; 
     customPinView.rightCalloutAccessoryView = rightButton; 

     [leftButton setTitle:annotation.title forState:UIControlStateNormal]; 
     customPinView.leftCalloutAccessoryView = leftButton; 

Il fonctionne, mais le bouton gauche apparaît comme un i dans un cercle Wite. Je souhaite que la voiture verte indique la disponibilité pour obtenir les directions. Comment puis-je faire cela?

Merci à l'avance

Répondre

3

Dans ce cas, vous devez créer votre bouton personnalisé.

UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
[leftButton setTitle:annotation.title forState:UIControlStateNormal]; 
[leftButton setBackgroundImage:[UIImage imageNamed:@"CAR_IMAGE.PNG"] forState:UIControlStateNormal]; 
customPinView.leftCalloutAccessoryView = leftButton; 
+0

merci @apurv, je vais essayer! – ghiboz