alt*_*exo 2 google-maps-api-3 ios9 xcode7 swift2
我有一个谷歌地图标记,我希望当我点击标记发送给我另一个viewController,或在我的地图上显示一个按钮,
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
Run Code Online (Sandbox Code Playgroud)
我解决了,这是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
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6190 次 |
| 最近记录: |