Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在uiview中显示谷歌地图_Ios_Objective C_Google Maps - Fatal编程技术网

Ios 在uiview中显示谷歌地图

Ios 在uiview中显示谷歌地图,ios,objective-c,google-maps,Ios,Objective C,Google Maps,我创建了UIView的一个子类,并将其粘贴到MyViewController中。在MyViewController中,我试图插入一个Google,但它不会影响一个白色屏幕。但是,如果我尝试将代码插入到类似的代码中,那么一切都正常工作 // this code work good UIAlertView *helloWorldAlert = [[UIAlertView alloc] initWithTitle:@"My Fi

我创建了UIView的一个子类,并将其粘贴到MyViewController中。在MyViewController中,我试图插入一个Google,但它不会影响一个白色屏幕。但是,如果我尝试将代码插入到类似的代码中,那么一切都正常工作

// this code work good 
UIAlertView *helloWorldAlert = [[UIAlertView alloc]
                                    initWithTitle:@"My First App" message:@"Hello, World!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    // Display the Hello World Message
    [helloWorldAlert show];
我需要做什么才能反映UIView谷歌地图的子类

// this is my code and this is not work


GMSMapView *mapView_;
[GMSServices provideAPIKey:@"#######"];



GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:1];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.settings.compassButton = YES;
mapView_.settings.myLocationButton = YES;

可以通过编程方式将mapView添加为UIView的子视图

你可以参考其他问题中的帖子

mapView.frame = CGRectMake(YOUR_MAP_X, YOUR_MAP_Y, YOUR_MAP_WIDTH, YOUR_MAP_HEIGHT);
[self.view addSubview:mapView_];

非常感谢,我甚至不知道如何感谢你,我正在研究这个问题的解决方案已经花了一周的时间,还有一个问题,卡可以工作,谢谢,但是缺少关键用户检测我的意思是它只是没有反映在地图上,在什么标记保持在原位-如何让她回来?不太确定你所说的用户交互是什么意思,但是您可以为您的视图启用用户交互。您可以执行类似yourView.userInteractionEnabled=YES的操作;我的意思是,我已经停止了工作线mapView_wk.settings.myLocationButton=YES;