2011-09-05 171 views

回答

0
NSString * urlString = nil; 

    urlString = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",12.58, 77.35, [NSString stringWithFormat:@"%@,%@,%@",[detailInfoDict valueForKey:@"address"],[detailInfoDict valueForKey:@"city"],[detailInfoDict valueForKey:@"state"]]]; 
    urlString = [urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: urlString]] 
0

您也可以使用这种方式。 第1步: 添加此框架

enter image description here

第2步:导入这些文件到您的视图控制器的.h文件 enter image description here

步骤3:在ViewControllers' .M提供2个地点的纬度和经度文件

enter image description here

输出:您将获得如下所示的结果

enter image description here

+0

从哪里我们应该找到两个文件? (Mapview.h和place.h),你必须在这里指定。 –

+0

你能提供这些(Mapview.h和place.h)文件吗? –

+0

您确定这是合法的,并且被Google允许吗? – manishnath

相关问题