Ios 我如何在ipad应用程序中的popover中打开谷歌地图?
我不知道如何在我的ipad应用程序中打开popover中的谷歌地图 目前我得到的只是一个空的popover和safari中打开的位置 这是我的密码:-Ios 我如何在ipad应用程序中的popover中打开谷歌地图?,ios,mapkit,uipopovercontroller,Ios,Mapkit,Uipopovercontroller,我不知道如何在我的ipad应用程序中打开popover中的谷歌地图 目前我得到的只是一个空的popover和safari中打开的位置 这是我的密码:- MapViewController *map = [[MapViewController alloc] init]; UITableView *cell = [tableView cellForRowAtIndexPath:indexPath]; map.stringURL = [NSString stringWithFormat:@"http
MapViewController *map = [[MapViewController alloc] init];
UITableView *cell = [tableView cellForRowAtIndexPath:indexPath];
map.stringURL = [NSString stringWithFormat:@"http://maps.google.co.in/maps?q="];
map.stringURL = [map.stringURL stringByAppendingString:[arr objectAtIndex:indexPath.section]];
map.stringURL = [map.stringURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:map.stringURL];
[[UIApplication sharedApplication] openURL:url];
popover = [[UIPopoverController alloc] initWithContentViewController:map];
popover.popoverContentSize = CGSizeMake(250, 250);
[popover presentPopoverFromRect:[cell frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
如果您使用的是故事板,您可以在新的视图控制器中简单地创建地图,然后使用带有“popover”选项的GoogleMap将前一个视图连接到新视图。
希望能解决你的问题 你几乎每件事都做对了。但是您将url发送到了错误的对象 在mapviewcontroller中,您可以拥有UIWebView,并将该webview的url设置为刚才创建的url 在这里,您要求safari启动并显示地图,实际上是退出应用程序 更好、更像Mapkit的是在webview中显示mapview而不是地图。我建议您查看mapkit上的文档,并查看Apple提供的MapCallout示例,该示例提供了一个很好的概述