Tag: 谷歌地图

IOS谷歌地图自定义InfoWindow Xib错误

你好! 我想使用Swift&Xib来制作自定义标记InfoWindow 创buildXib – 尺寸宽度:200 /高度:200 但不改变应用程序的大小 所以我在程序中以编程方式设置大小Infowindow.frame.size.width = 200 Infowindow.frame.size.height = 200 现在改变大小! 顺便说一下,我想在Xib中改变大小,但现在正在工作…我该怎么办?

Google地图不会显示xcode8.2的新版本

我尝试使用Swift和Xcode 8.2的iOS版Google Maps SDK。 我已经设置了正确的API密钥。 我使用Google Map SDK网站示例代码。 let camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 6) let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera) mapView.myLocationEnabled = true myView = mapView 它会显示错误: 'cameraWithLatitude(_:longitude:zoom :)'已被重命名为'camera(withLitude:longitude:zoom :)' swift:84:47:'CGRectZero'在Swift中不可用 swift:85:17:'myLocationEnabled'已被重命名为'isMyLocationEnabled' 所以我改成如下所示: let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6) let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera) myView.isMyLocationEnabled = true myView […]

iOS – 从代码运行第三方导航应用程序

我是新来的iOS,我想从我自己的应用程序运行导航应用程序。 现在我只是使用这个代码: – (void)navigationButtonTap:(id)sender { Class mapItemClass = [MKMapItem class]; if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) { // Create an MKMapItem to pass to the Maps app CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake([actualPlace.latitude doubleValue], [actualPlace.longitude doubleValue]); MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil]; MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark]; [mapItem setName:actualPlace.Name]; // Pass the map item to the […]

无法使用Google地图API(GMSMapView)获取当前位置

我尝试使用Google Map API从当前位置到另一个位置的方向。 当我手动input原点和目标点时,一切正常。 但是,当我尝试将原点设置为当前位置时,位置为下面的代码为空: mainMap=[[GMSMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:[mainMap.myLocation coordinate] zoom:13]; mainMap.camera=camera; mainMap.myLocationEnabled=YES; // <—- The blue point appear on map: it's exactly my location [self.view addSubview:mainMap]; //Get mylocation CLLocation *myLocation = mainMap.myLocation; // <—– NULL 有没有人知道我的问题在这里? 很多

当使用GoogleMaps时,myLocationEnabled在swift上更改为isMyLocationEnabled

我试图让用户目前的位置显示与谷歌地图API。 我一直在努力解决这个问题几个星期,代码运行,但没有更新到当前位置,当我在模拟器中更改位置。 我的代码是在下面,看看其他人在做什么,他们都有mapView.myLocationEnabled = true,而对于我这会产生一个错误,说'myLocationEnabled已被重命名为'isMylocationEnabled'。 我见过一些最新的post(从2个月前),每个人都使用myLocationEnabled似乎没有错误,为什么我得到这个? 这可能是我目前的位置没有更新的原因吗? import UIKit import GoogleMaps class FirstViewController: UIViewController, CLLocationManagerDelegate { @IBOutlet weak var mapView: GMSMapView! let locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self mapView.settings.myLocationButton = true mapView.settings.compassButton = true } override func viewDidAppear(_ animated: Bool) { locationManager.requestWhenInUseAuthorization() } func locationManager(manager: CLLocationManager , didChangeAuthorizationStatus status: CLAuthorizationStatus) […]

使用Swift 3自定义视图中的Google Maps绘制折线

我试图在自定义UIView上使用Google地图的两个地方之间绘制路线,但无法正确实施。 我的自定义视图是mapViewX。 我已经使用pod安装了Google sdk,其中包括pod“GoogleMaps”和pod“GooglePlaces”。 我把自定义类作为“GMSMapView”。 我的代码是: @IBOutlet weak var mapViewX: GMSMapView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let path = GMSMutablePath() path.add(CLLocationCoordinate2D(latitude: 37.778483, longitude: -122.513960)) path.add(CLLocationCoordinate2D(latitude: 37.706753, longitude: -122.418677)) let polyline = GMSPolyline(path: path) polyline.strokeColor = .black polyline.strokeWidth = 10.0 polyline.map = mapViewX […]

如何在我的iOS应用程序中为Google地图创build多个标记?

我无法find我如何在iOS应用程序的谷歌地图上放置多个标记的答案。 我知道这可以做,但我不知道该怎么做。 这是使用一些谷歌文档,但我的应用程序将显示纽约市的地点。 这是我错误的代码:在GoogleMapsViewController.m我有以下代码: // GoogleMapsViewController.m // GoogleMaps1 // // Created by Meghan on 2/1/14. // Copyright (c) 2014 Meghan. All rights reserved. // #import "GoogleMapsViewController.h" #import <GoogleMaps/GoogleMaps.h> @interface GoogleMapsViewController () @end @implementation GoogleMapsViewController { GMSMapView *mapView_; } – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a […]

谷歌search的地方API,找不到的地方

有些地方是不是从谷歌APIfind,它用来返回结果之前的最后一次更新,但它不再。 例子 : 必胜客 – 法国 多米诺的披萨 – 法国 进出汉堡 – 洛杉矶 等等.. https://maps.googleapis.com/maps/api/place/search/json?sensor=false&location=34.029900,-118.255463&radius=5000&key=API_KEY&name=In-N-Out%20Burger https://maps.googleapis.com/maps/api/place/search/json?sensor=false&location=48.847194,2.408152&radius=5000&key=API_KEY&name=Pizza%20Hut https://maps.googleapis.com/maps/api/place/search/json?sensor=false&location=48.847194,2.408152&radius=5000&key=API_KEY&name=Domino's%20Pizza 你知道为什么吗 ?

在Google地图中移动相机

我正试图将相机在Google地图中移动到指定位置(经纬度)。 这是我的代码/函数,这个代码位于ViewController1(它包含mapView的视图): func select_structure(lat: String, lon: String){ let camera = GMSCameraPosition.cameraWithLatitude(Double(lat)!, longitude: Double(lon)!, zoom: 6.0) mapView = GMSMapView.mapWithFrame(CGRect.zero, camera: camera) mapView.myLocationEnabled = true mapView.mapType = kGMSTypeSatellite mapView.camera = camera view = mapView populate_structures2() let newcamera = GMSCameraPosition.cameraWithLatitude(Double(lat)!, longitude: Double(lon)!, zoom: 17.0) self.mapView.animateToCameraPosition(newcamera) print(mapView) } 当我在ViewController2中调用该代码时,第一次运行应用程序时,它不起作用。 当我使用这个函数时,什么都不会发生 但是我知道它正在被阅读。 而当我运行它的第二,第三等,它的作品! 只是一个简短的说明。 ViewController2是一个滑动菜单。 我从ViewController1调用这个函数: var ClassViewController = self.storyboard!.instantiateViewControllerWithIdentifier("ViewController") […]

当使用谷歌方向Api和请求数据在JSON获取零数据

我是新手,编程和iOS开发与迅速。 我试图在两个地点之间映射一条路线,并遇到了这个问题。 func getDirections(origin: String!, destination: String!, waypoints: Array<String>!, travelMode: AnyObject!, completionHandler: ((status: String, success: Bool) -> Void)) { if let originLocation = origin { if let destinationLocation = destination { var directionsURLString = baseURLDirections + "origin=" + originLocation + "&destination=" + destinationLocation directionsURLString = directionsURLString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)! let directionsURL = NSURL(string: directionsURLString) dispatch_async(dispatch_get_main_queue(), { () -> […]