地图未显示在网络视图中 - iOS
Maps not being shown in webview- iOS
我的视图中有一个按钮。单击它会导致我想在其中显示地图的网络视图。我使用的代码是:
- (void)viewWillAppear:(BOOL)animated{
NSString *url = [@"http://maps.apple.com/?q=" stringByAppendingString:self.address];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
NSURLRequest *metricsRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
_webViewForLocation.delegate = self;
[_webViewForLocation loadRequest:metricsRequest];
NSLog(@"Maps String: %@", url);
}
但是网络视图是空白的。如何在其中显示地图?
尝试
- (void)viewDidLoad
{
[super viewDidLoad];
[_webViewForLocation loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/?q=bangalore"]]]]; // here pass your string
- (void)webViewDidStartLoad:(UIWebView *)webView
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
输出是
指的是这个document、
我的视图中有一个按钮。单击它会导致我想在其中显示地图的网络视图。我使用的代码是:
- (void)viewWillAppear:(BOOL)animated{
NSString *url = [@"http://maps.apple.com/?q=" stringByAppendingString:self.address];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
NSURLRequest *metricsRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
_webViewForLocation.delegate = self;
[_webViewForLocation loadRequest:metricsRequest];
NSLog(@"Maps String: %@", url);
}
但是网络视图是空白的。如何在其中显示地图?
尝试
- (void)viewDidLoad
{
[super viewDidLoad];
[_webViewForLocation loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/?q=bangalore"]]]]; // here pass your string
- (void)webViewDidStartLoad:(UIWebView *)webView
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
输出是
指的是这个document、