gpt4 book ai didi

ios - MKPinAnnotationView左侧按钮带有图像

转载 作者:行者123 更新时间:2023-12-01 19:10:29 26 4
gpt4 key购买 nike

这是我的代码:

        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;

它可以工作,但是左键看起来像一个i在一个圆圈中。
我希望这辆绿色的汽车能够指示可获得的路线。
我怎样才能做到这一点?

提前致谢

最佳答案

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

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

关于ios - MKPinAnnotationView左侧按钮带有图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16872796/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com