Google Maps SDK无法在UIView中正常显示? [英] Google Maps SDK not displaying properly in UIView?
本文介绍了Google Maps SDK无法在UIView中正常显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Xcode 6.1中显示谷歌地图时遇到一些问题
I'm having some problems displaying google maps in Xcode 6.1
我设法让地图显示在我的UIView的一部分中,但它显示了世界地图而不是特定坐标。
I managed to get the map to display in a section of my UIView, but it displays the world map instead of at a particular coordinate.
以下是问题:
.h:
@interface MapViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *googleMapView;
- (IBAction)mapToMain:(UIButton *)sender;
@end
.m:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude: 32.915134
longitude: -117.140269 zoom: 17];
GMSMapView *mapView = [GMSMapView mapWithFrame:self.googleMapView.bounds
camera:camera];
mapView.myLocationEnabled = YES;
self.googleMapView = mapView;
GMSMarker *marker = [ [GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(32.915134, -117.140269);
marker.title = @"Tet Festival 2015";
marker.snippet = @"VAYA Tet";
marker.map = mapView;
}
我在这里看到了一些建议,但它不起作用:
I saw some suggestions here, but it didn't work:
不能将谷歌地图GMSMapView放在主要主视图的子视图中?
有任何建议吗?
推荐答案
最后想出来......
Finally figured it out...
已删除:
self.googleMapView = mapView;
已替换:
[self.googleMapView addSubview:mapView];
这篇关于Google Maps SDK无法在UIView中正常显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文