这是我的代码:
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圈中的i。 我希望绿色汽车能够指示获取方向的可用性。 我怎么能这样做?
提前致谢
答案 0 :(得分:3)
在这种情况下,您应该创建自定义按钮。
UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftButton setTitle:annotation.title forState:UIControlStateNormal];
[leftButton setBackgroundImage:[UIImage imageNamed:@"CAR_IMAGE.PNG"] forState:UIControlStateNormal];
customPinView.leftCalloutAccessoryView = leftButton;