gpt4 book ai didi

ios - 如何在 objective-c 中的谷歌地图上显示印度 map

转载 作者:行者123 更新时间:2023-11-29 11:48:03 24 4
gpt4 key购买 nike

我是 iOS 新手,在 Google map 上显示印度 map 时遇到问题我的代码首先是这样的

 GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:18.516726
longitude:73.856255
zoom:3];

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
//Scrollview
mapView = [GMSMapView mapWithFrame:CGRectMake(10, 140, 750, 350) camera:camera];
}
else
{
//Scrollview
mapView = [GMSMapView mapWithFrame:CGRectMake(10, 140, 550, 350) camera:camera];

}

但是当我使用 UIView 并像这样使用 IBOutlet 创建它时

IBOutlet GMSMapView *mapView;

比上面的代码不起作用。我怎样才能使用上面的坐标首先显示印度 map 。提前致谢!

最佳答案

获取当前位置坐标并传递这些相机位置

CLLocationCoordinate2D coordinate;
float latitude;
float longitude;

coordinate = [self getLocation];
latitude = coordinate.latitude;
longitude = coordinate.longitude;

//pragma mark ----: GET Coordinate2D :----

-(CLLocationCoordinate2D) getLocation
{
CLLocation *location = [_locationManager location];
coordinate = [location coordinate];
return coordinate;
}

CGRect frame = CGRectMake(0, 0, kSCREEN_WIDTH,kSCREEN_HEIGHT);
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude longitude:longitude zoom:12];
mapView_ = [GMSMapView mapWithFrame:frame camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.delegate = self;

[mapView_ setCamera:camera];

关于ios - 如何在 objective-c 中的谷歌地图上显示印度 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42485459/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com