0
私は自分のウェブアプリケーションを1つのウェブビューに残し、サファリのドメイン外にリンクを開くようにしました。私がする必要があるのは、サファリで開くドメインにある.pdfファイルを追加することです。今のところ、彼らはWebビューで開き、そこから抜け出すためのナビゲーションがないので、アプリケーションを強制的に強制して再起動する必要があります。あなたは、ナビゲーションを追加したい場合は私のウェブビューアプリからサファリの.pdfファイルを開く方法
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://rbc.samkingmedia.com"]]];
_webView.delegate = self;
[_webView addSubview:activityind];
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
}
-(void)loading {
if (!_webView.loading)
[activityind stopAnimating];
else
[activityind startAnimating];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
// open External Links (not beginning with www.playbuzz.org/ in Safari.app
if (
(navigationType == UIWebViewNavigationTypeLinkClicked) &&
(![[[request URL] absoluteString] hasPrefix:@"http://rbc.samkingmedia.com/"])
) {
[[UIApplication sharedApplication] openURL:request.URL];
return NO;
}
//open Internal links in uiwebview
return YES;
}