如何将Google MapView放入UIView? [英] How put Google MapView in UIView?
本文介绍了如何将Google MapView放入UIView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Google MapView放在 UIView
中,但我什么都没显示。
I'm trying to put Google MapView in UIView
but I get nothing displayed.
我的代码,
*。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_];
所以,我得到了解决方案。无论如何,谢谢。
So, i got the solution. Thanks anyway.
祝你好运。
推荐答案
解决方案:
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_];
这篇关于如何将Google MapView放入UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文