我正在尝试将Google MapView放入UIView
,但没有显示任何内容。如何把Google MapView放在UIView中?
我的代码,
的* .h
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIBarButtonItem *btnLocate;
@property (weak, nonatomic) IBOutlet GMSMapView *mapView_;
@property (weak, nonatomic) IBOutlet UIView *mapView;
@end
* .M
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
self.mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.mapView_.myLocationEnabled = YES;
self.mapView = self.mapView_;
感谢。
解决方案
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
// Indicating the map frame bounds
self.mapView_ = [GMSMapView mapWithFrame:self.mapView.bounds camera: camera];
self.mapView_.myLocationEnabled = YES;
// Add as subview the mapview
[self.mapView addSubview: self.mapView_];
所以,我得到了解决。不管怎么说,还是要谢谢你。
此致敬礼。
后,作为回答,然后接受,这将是很有益的 – Vinodh