我正在整合谷歌地图sdk.一切正常.但是当第二个出现时如何删除特定标记(Pin Point).(我不使用Mapkit)
我想要以下内容:
如果我点击地图然后现在在该位置生成一个标记引脚,如果我点击地图上的另一个位置然后显示两个引脚但我想要移除旧的标记引脚.
我也用,
[self.mapView clear];
Run Code Online (Sandbox Code Playgroud)
但很明显GMSMapview中的所有其他标记点.
以下是在地图上添加图钉的代码:
GMSMapView *mapView;
GMSMarker *currLocMarker = [[GMSMarker alloc] init];
currLocMarker.map = nil;
[currLocMarker setTitle:NSLocalizedString(@"current_location_title", nil)];
currLocMarker.icon = [UIImage imageNamed:@"pin_fetch_location.png"];
currLocMarker.position = CLLocationCoordinate2DMake(pCoordinate.latitude, pCoordinate.longitude);
currLocMarker.map = self.mapView;
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.. !!
提前致谢..:)
我正在学习Google Maps SDK并了解Swift,当我创建一个以我的位置为中心的mapview时myLocation = true,位置气泡显示出来,但它周围出现了一个方形面具,就像这样

我没有对位置指示器执行任何操作,至少不是故意的.
有没有人遇到过这个问题?
在国外使用我的应用程序时,谷歌GMSGeocoder会自动以本地语言返回响应.如何将其设置为始终以英语返回响应?
我使用GMS SDK 1.7,我的代码是这样的:
GMSGeocoder *geoCoder = [[GMSGeocoder alloc] init];
[geoCoder reverseGeocodeCoordinate:self.cellLocation.coordinate completionHandler:^(GMSReverseGeocodeResponse *respones, NSError *err) {
if([respones firstResult]) {
GMSAddress* address = [respones firstResult];
NSString* fullAddress = [NSString stringWithFormat:@"%@, %@",address.thoroughfare, address.locality];
self.theTextField.text = fullAddress;
} else {
self.theTextField.text = @"";
}
}];
Run Code Online (Sandbox Code Playgroud) 我想添加一个API_KEY进行GoogleMaps测试,并且在文档中我已经读过:
提示:在开发和测试期间,您可以在Google Cloud Platform Console中注册项目以进行测试,并使用通用的不受限制的API密钥。当您准备将应用程序投入生产时,请注册一个单独的项目进行生产,创建一个受Android限制的API密钥,然后将该密钥添加到您的应用程序中。
我的问题是,即使它是测试API_KEY,我也必须放我的信用卡吗?我的目的不是让我的Creadit卡使用Google地图,这不是免费的吗?
我正在GMSMarker引脚上播放视频,下面是我的代码.显示和隐藏/显示引脚视图,一切正常.视频不播放除外.我正在使用带有pinview的故事板.
@interface MapViewController () <GMSMapViewDelegate>
@property (strong, nonatomic) IBOutlet GMSMapView *mapView;
@property (strong, nonatomic) IBOutlet UIView *pinView;
@property (strong, nonatomic) GMSMarker *london;
@property (strong, nonatomic) AVPlayer *player;
@property (strong, nonatomic) AVPlayerLayer *playerLayer;
@end
@implementation MapViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:51.5 longitude:-0.127 zoom:18];
self.mapView.camera = camera;
self.mapView.delegate = self;
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127);
_london = [GMSMarker markerWithPosition:position];
_london.title = @"London";
_london.tracksViewChanges = YES;
_london.map = self.mapView; …Run Code Online (Sandbox Code Playgroud) 我想在GMSMapView上显示一个箭头图像(我正在使用谷歌地图sdk).现在,如果我开车(箭头显示我当前的位置),我必须左转,然后我必须改变mapView的方位.但我不知道该怎么做.
我试图改变didUpdateHeading中的方位
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{
if(newHeading.headingAccuracy>0)
{
float heading = newHeading.magneticHeading; //in degrees
//heading = (heading*M_PI/180);
//NSLog(@"heading=%f", heading);
[mapView animateToBearing:heading];
}}
Run Code Online (Sandbox Code Playgroud)
headingFilter设置为12.
我也尝试过trueHeading,但是磁性攻击虽然提供了更好的结果但不准确.
请帮忙.
https://developers.google.com/maps/documentation/ios-sdk/utility/marker-clustering
我正在为地图聚类工作.在地图聚类中
private var mapView: GMSMapView!
Run Code Online (Sandbox Code Playgroud)
用于mapView但找不到任何GMSMapView!在故事板连接.
从故事板我发现
@IBOutlet var mapView: MKMapView!
Run Code Online (Sandbox Code Playgroud)
这就产生了问题.当我使用exampled谷歌地图时,它会抛出错误
这个类不是键值mapView的关键值编码兼容.
这里有完整的代码:
import UIKit
import MapKit
import GooglePlaces
import GoogleMaps
// Point of Interest Item which implements the GMUClusterItem protocol.
class POIItem: NSObject, GMUClusterItem {
var position: CLLocationCoordinate2D
var name: String!
init(position: CLLocationCoordinate2D, name: String) {
self.position = position
self.name = name
}
}
let kClusterItemCount = 10000
let kCameraLatitude = -33.8
let kCameraLongitude = 151.2
class FirstViewController: UIViewController , GMUClusterManagerDelegate,
GMSMapViewDelegate {
// @IBOutlet var mapView: …Run Code Online (Sandbox Code Playgroud) 我刚升级到Xcode 7.1.当我尝试设置GMSMapView的mapType时,我得到错误模糊地使用'kGMSTypeNormal',模糊地使用'kGMSTypeTerrain',以及模糊地使用'kGMSTypeHybrid'.
@IBOutlet weak var mapView: GMSMapView!
func myfunc() {
if let myMapType = NSUserDefaults.standardUserDefaults().stringForKey(SettingsTableViewController.History.MapType) {
switch myMapType {
case "kGMSTypeNormal":
mapView.mapType = kGMSTypeNormal
case "kGMSTypeTerrain":
mapView.mapType = kGMSTypeTerrain
case "kGMSTypeHybrid":
mapView.mapType = kGMSTypeHybrid
default: break
mapView.mapType = kGMSTypeNormal
}
} else {
mapView.mapType = kGMSTypeNormal
}
}
Run Code Online (Sandbox Code Playgroud) 我在我的 iOS 应用程序中使用谷歌地图服务 GMSMapview。因为我有两个 CLLocationCoordinates。一个是当前位置,另一个是目标位置。我试图将地图放在这两个地方。
但是相机位置没有设置在这两个点内。我尝试使用以下代码,
CLLocationCoordinate2D start = CLLocationCoordinate2DMake(newLoc.coordinate.latitude, newLoc.coordinate.longitude);
CLLocationCoordinate2D end = CLLocationCoordinate2DMake(_retailerVO.R_Latitude, _retailerVO.R_Longitude);
GMSCoordinateBounds *gBounds =
[[GMSCoordinateBounds alloc] initWithCoordinate:start coordinate:end];
GMSCameraPosition *gCamera = [mapView_ cameraForBounds:gBounds insets:UIEdgeInsetsZero];
mapView_.camera = gCamera;
Run Code Online (Sandbox Code Playgroud)
有什么方法可以实现我的目标吗?所有建议表示赞赏。
gmsmapview ×10
ios ×8
google-maps ×6
swift ×4
iphone ×2
objective-c ×2
android ×1
geocoding ×1
ios6 ×1
mkmapview ×1
polyline ×1
swift2 ×1
video ×1