所以我在我的一个主要视图的小视图中有一个谷歌地图,我正试图获得一个徽章来显示一个位置,就像他们的例子中的谷歌秀..但经过多年的努力获得要在可调整大小的视图中显示的地图(所以我可以在另一个视图中显示),我完成它的方式似乎没有办法添加徽章。
到目前为止,这是我的代码:
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
// Create marker
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(-33.86, 151.20);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
self.map.camera = camera;
self.map(在.h文件中):
@property (weak, nonatomic) IBOutlet GMSMapView *map;
这是谷歌的例子:
// Google map
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
但我似乎无法将两者结合起来
答案 0 :(得分:0)
对于遇到类似问题的任何人: 这就是我使用谷歌地图+徽章的自定义视图解决的方法
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6];
// set camera location to Novi Sad, Serbia :-)
[self.mymap setCamera:camera]; // set the camera to map
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mymap;