現在GoogleMaps for sdk ios を使用してアプリを作成しています。
マーカの吹き出しをタップしたときにある動作を行いたいのですが、吹き出しをタップしても何も動作されません
何がおかしいでしょうか?
マーカは現在
Swift
1 2import UIKit 3import CoreLocation 4import GoogleMaps 5import GooglePlaces 6import GoogleMapsUtils 7 8class ViewController: UIViewController,CLLocationManagerDelegate,GMSMapViewDelegate{ 9 10 var locationManager: CLLocationManager! 11 var currentLocation: CLLocation? 12 var mapView = GMSMapView() 13 var placesClient: GMSPlacesClient! 14 var marker = GMSMarker() 15 16 17 override func viewDidLoad() { 18 super.viewDidLoad() 19 20 var readkml = false 21 mapView.delegate = self 22 self.marker = GMSMarker() 23 24 25 readkml = UserDefaults.standard.bool(forKey: "readkml") 26 print(readkml) 27 28 29 locationManager = CLLocationManager() 30 locationManager?.delegate = self 31 if CLLocationManager.locationServicesEnabled(){ 32 locationManager?.startUpdatingLocation() 33 } 34 35 36 let camera = GMSCameraPosition.camera(withLatitude: 35.65837, longitude: 139.74127, zoom: 6.0) 37 mapView = GMSMapView.map(withFrame: self.view.bounds, camera: camera) 38 mapView.settings.compassButton = true 39 self.view.addSubview(mapView) 40 self.view.sendSubviewToBack(mapView) 41 mapView.isMyLocationEnabled = true 42 mapView.settings.myLocationButton = true 43 44 } 45 46 } 47@IBAction func AddPin(_ sender: Any) { 48 let mylocation = mapView.myLocation 49 50 let nowlat = mylocation?.coordinate.latitude 51 let nowlng = mylocation?.coordinate.longitude 52 let nowalt = mylocation?.altitude 53 print(nowlat!) 54 print(nowlng!) 55 print(nowalt!) 56 57 self.marker = GMSMarker() 58 59 //let marker: GMSMarker = GMSMarker() 60 marker.position = CLLocationCoordinate2D(latitude: nowlat!, longitude: nowlng!) 61 marker.title = "pin(pincounter)" 62 marker.snippet = "緯度:(String(nowlat!))" + "\n" + "経度:(String(nowlng!))" 63 print(marker.title!) 64 marker.map = mapView 65} 66 67 68 69 70 func mapView(_ mapView: GMSMapView, didTapInfoWindowOf marker: GMSMarker) { 71 print("info tap") 72 } 73 74
回答1件
あなたの回答
tips
プレビュー