How to open Google Street View in UIWebView?
I´m trying to open street view in UIWebView but it doesn´t work. I can see just normal maps. How can I solve it? Any other possibilities?
that´s my code:
NSString *urlAddress = @"http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=bran+castle&sll=44.439972,26.096894&sspn=0.000869,0.003664&ie=UTF8&hq=Bran+Castle&hnear=Bran+Castle,+Strada+General+Traian+Mo%C8%99oiu+nr.+2开发者_如何学Python8+E574,+Bran+507025,+Romania&t=k&layer=c&cbll=45.516381,25.368123&panoid=0d7jjq7vdWGTxFyonEKnBQ&cbp=12,209.81,,1,-18.52&ll=45.516381,25.368123&spn=0,0.008444&z=17";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webV loadRequest:requestObj];
Try loading this code for your UIWebview:
NSString *latLongString =[NSString stringWithFormat:@"%f,%f", latitude, longitude];
[_uiWebView loadHTMLString:[NSString stringWithFormat:@"<html><head><meta name='viewport',user-scalable=no'/><script src='http://maps.google.com/maps/api/js?sensor=false'type='text/javascript'></script></head><body onload=\"new google.maps.StreetViewPanorama(document.getElementById('p'),{position:new google.maps.LatLng(%@)});\" style='padding:0px;margin:0px;'><div id='p' style='height:100%%; width:100%%;'></div></body></html>",latLongString] baseURL:nil];
No. U can't achieve this .
see here but u can like this
http://maps.google.com/?q=Tokyo@35.680,139.769
u can pass this link to ur webview to load it.
see here
Does MapKit allow for StreetView?
Simply Run the Google map url request in your webView and in webViewDidFinishLoad method add this below line to hide alert. webView.stringByEvaluatingJavaScriptFromString("document.getElementsByClassName('ml-unsupported-link-dialog-container')[0].style.display='none'")
Here is a sample call to load Google StreetView in UIWebView. I used Swift.
let urlAddress = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=bran+castle&sll=44.439972,26.096894&sspn=0.000869,0.003664&ie=UTF8&hq=Bran+Castle&hnear=Bran+Castle,+Strada+General+Traian+Mo%C8%99oiu+nr.+28+E574,+Bran+507025,+Romania&t=k&layer=c&cbll=45.516381,25.368123&panoid=0d7jjq7vdWGTxFyonEKnBQ&cbp=12,209.81,,1,-18.52&ll=45.516381,25.368123&spn=0,0.008444&z=17";
let request = NSURLRequest(URL: NSURL(string: urlAddress)!)
glWebView.loadRequest(request)
精彩评论