gpt4 book ai didi

google-maps-api-3 - 将 Action 点击分配给谷歌地图标记,swift 2

转载 作者:行者123 更新时间:2023-12-03 22:58:18 24 4
gpt4 key购买 nike

我有一个谷歌地图标记,我希望当我点击标记时将我发送到另一个 View Controller ,或者在我的 map 上显示一个按钮,

let marker1 = GMSMarker()
marker1.position = CLLocationCoordinate2DMake(24.8236423, -107.4234671)
marker1.appearAnimation = kGMSMarkerAnimationPop
marker1.icon = UIImage(named: "flag_icon")
marker1.title = "Any title"
marker1.snippet = "Any text"
marker1.map = mapView

最佳答案

我解决了,这是tap功能

    //Market Tap Function
func mapView(mapView: GMSMapView!, didTapMarker marker: GMSMarker!) -> Bool {
let myFirstButton = UIButton()
myFirstButton.setTitle("✸", forState: .Normal)
myFirstButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
myFirstButton.frame = CGRectMake(15, -50, 300, 500)
myFirstButton.addTarget(self, action: "pressed:", forControlEvents: .TouchUpInside)

self.view.addSubview(myFirstButton)
return true
}

关于google-maps-api-3 - 将 Action 点击分配给谷歌地图标记,swift 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33156279/

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