我使用谷歌地图iOS SDK和故事板。应用程序从导航视图控制器开始,该控件具有带map的根视图控制器。
@implementation MyViewController
@synthesize btnMyLock;
@synthesize btnNearby;
GMSMapView *mapView_;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
GMSCameraPosition *camera
我已经在Objective-C中添加了带pods的GoogleMap SDK。
我正在使用桥头在Swift项目中使用。
在appdelegate中,我使用以下代码来提供api密钥
GoogleMapsService.provideAPIKey(kGooglePlacesApiKey)
// where kGooglePlacesApiKey is the key generated on google console.
在ViewController中,我使用以下代码添加谷歌地图
func addGoogleMap()
{
let camera = GMSCameraPosition.
我正在努力为我的地图上的标记创建我自己的信息窗口。为此,我创建了View.xib,以按我需要的方式配置它,并从实现映射的类中调用它。地图显示,两个标记,但没有结果时,我点击标记。我怎样才能正确地指出这一点?
class MapView: UIView,CLLocationManagerDelegate,GMSMapViewDelegate {
@IBOutlet var contentView: UIView!
let mapView = GMSMapView(frame: CGRect.zero,camera: GMSCameraPosition.camera(withTarget:
下面是我的代码示例:
class UserViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate {
var mapView: GMSMapView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if mapView == n
我正在使用谷歌地图教程(),并通过将其嵌入到选项卡控制器中对其进行了增强。一旦我创建了第二个标签,它就不再起作用了。
如果我将它移到主选项卡(默认选项卡),它工作得很好,但在其他情况下,它看起来不会拉出位置,甚至不会显示所有控件。我已经将逻辑从viewDidLoad()移到了viewWillAppear(),但这也没有帮助。
有什么可能导致这个问题的想法吗?
这是来自MapViewController.swift的代码
//
// MapViewController.swift
// Feed Me
//
// Created by Ron Kliffer on 8/30/14.
//
我有一个自定义的UIView (带有xib、.h和.m文件),我想让它成为我的GMSMarker的信息窗口。但当我在-mapView: markerInfoWindow:方法中返回我的自定义UIView时,应用程序就被冻结和卡住了(它甚至没有崩溃)。
我的代码是:
-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
{
//Creating "infoWindow"(infoWindow) and setting it with nib file called
我试图在一个针对iOS 8的Swift项目中使用Google for iOS 8,我添加了Objective桥接头,并按照他们的中的指示添加了Google。我试了一下的例子,结果一切都很好。
我需要显示我现在的位置。我在我的iOS 8模拟器中设置了自定义位置的坐标,并修改了代码,如 StackOverflow答案中所示。下面是它的Swift版本。
import UIKit
import Foundation
class MapViewController: UIViewController {
@IBOutlet var mapView: GMSMapView!
var
我已经在使用GMSGeometryContainsLocation方法来确定坐标(来自tap用户)是否在GMSPolygon中,但是我无法使它对GMSPolyline起作用。
-(void) didTapOnPolyline:(CLLocationCoordinate2D)coordinate andMap:(GMSMapView *)mapView {
if (_pathVS != nil) {
for (id key in _pathVS) {
if (GMSGeometryIsLocationOnPath(coordinate, [_pat
我使用3.1.0版本的Google Maps SDK for iOS。在loadView函数中将view分配给GMSMapView时,应用程序崩溃,并出现以下错误:'NSInvalidArgumentException', reason: 'GMSx_GMMClientPropertiesRequestProto.screenPixelDensity: Attempt to set an unknown enum value (0)'。这真的很奇怪为什么会发生这种事。我试图降级谷歌地图的版本,但它没有帮助。在AppDelegate中,我提供了API_KEY。以下
嗨,当我在ios上使用谷歌地图时,我遇到了一些问题。首先,我安装了可可荚并设置了google。(并将api密钥插入AppDelegate.swift文件)
但是这个错误发生了:( ->线程1:信号SIGABRT )
问题出在哪里?
这是代码
import UIKit
import GoogleMaps
class LocationAddVC: UIViewController{
//Take a Google Map Object.
// Don't make outlet from Storyboard,
// Break the outlet of GMSMapView
我对iOS的开发非常陌生,并且试图用SIGABRT的信息来解决我的应用程序崩溃的原因。我正在学习如何实现Google的教程(),据我所知,我有相同的代码。
我的代码:
@IBOutlet weak var mapView: GMSMapView!
let locationManager = CLLocationManager()
var didFindMyLocation = false
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading th