Hide address bar of UiWebview when showing google maps on it
i m sho开发者_如何学JAVAwing map on UIWebView using this..
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f",
latitudeValue,longitudeValue]];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[url release];
[web loadRequest:requestObj];
[web stringByEvaluatingJavaScriptFromString:@"window.scrollTo(0, 250);"];
but "stringByEvaluatingJavaScriptFromString
" not working.. please help me to solve this..
i want to hide address bar,and i know which is not a part of UiWebview ...
You are attempting to link directly to the Google Maps service, the page the iPhone users are shown when they visit maps.google.com. Instead, you should either use a MapView in your application or one of the Google Maps APIs, such as a static map.
Just to address your other issue, the execution of the Javascript, the problem is that the page needs to be loaded before the Javascript is executed. Assign a delegate to UIWebView and listen for webViewDidFinishLoad and then you can safely execute the javascript.
精彩评论