//判断有没有安装百度地图客户端
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"baidumap://"]]) {
//百度地图app
NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/place/search?query=公交站&location=%@,%@&radius=1000®ion=%@&src=幸福爱家",latitudeS,longitudeS,cityS] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}else{
UIWebView *webview = [[UIWebView alloc]init];
webview.frame = CGRectMake(0, 0, screenWidth,screenHeight-64);
//webview.delegate=self;
[self.view addSubview:webview];
NSString *urlString = [[NSString stringWithFormat:@"http://api.map.baidu.com/place/search?query=公交&location=%@,%@&radius=1000®ion=%@&src=项目名称&output=html",_latitude,_longitude,_cityStr] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
[webview loadRequest:[NSURLRequest requestWithURL:url]];
}
转载于:https://my.oschina.net/wenchengxu123/blog/844371