【发布时间】:2014-11-06 01:58:31
【问题描述】:
我在 Xcode 6.1 中显示谷歌地图时遇到了一些问题
我设法让地图显示在我的 UIView 的一部分中,但它显示的是世界地图而不是特定坐标。
问题来了:
.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;
}
我在这里看到了一些建议,但没有奏效:
Cannot put a google maps GMSMapView in a subview of main main view?
Using the Google Maps SDK in views other than the main view
有什么建议吗?
【问题讨论】:
标签: ios objective-c xcode xcode6