2013-06-01 39 views
1

這裏是我的代碼:MKPinAnnotationView左鍵與圖片

 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; 

它的工作原理,但似乎像在WITE一圈我左邊的按鈕。 我希望綠色汽車指示可用性獲取方向。 我該怎麼做?

在此先感謝

回答

3

在這種情況下,您應該創建自定義按鈕。

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

謝謝@apurv,我會盡力! – ghiboz