1

这是我的代码:

        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;

它可以工作,但左边的按钮看起来像一个白圈中的 ai。我希望绿色的汽车表明可以获取路线。我怎样才能做到这一点?

提前致谢

4

1 回答 1

3

在这种情况下,您应该创建自定义按钮。

UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftButton setTitle:annotation.title forState:UIControlStateNormal];
[leftButton setBackgroundImage:[UIImage imageNamed:@"CAR_IMAGE.PNG"] forState:UIControlStateNormal];
customPinView.leftCalloutAccessoryView = leftButton;
于 2013-06-01T12:58:33.647 回答