[英]Can we load the terms and conditions as a PDF in a UIWebview for IOS apps?
I am adding terms and conditions to my app in a UIWebview. 我在UIWebview中向我的应用添加了条款和条件。 What i really want to know is can i show it as a page by page pdf document or should i use any other method?
我真正想知道的是,我可以将其作为页面pdf文档显示,还是应该使用任何其他方法? Will App store accept the pdf format?
App商店会接受pdf格式吗?
Yes, this can be done using UIWebview
and surely will get accepted by Apple . 是的,这可以使用
UIWebview
完成,肯定会被Apple接受 。
If you are trying to display a PDF file from a web URL , use the below code. 如果您尝试从Web URL显示PDF文件,请使用以下代码。
NSURL *targetURL = [NSURL URLWithString:@"http://yourdomain.com/file_toopen.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
Or if you have a PDF file bundled with in your application, use below code. 或者,如果您的应用程序中捆绑了PDF文件,请使用以下代码。
NSString *path = [[NSBundle mainBundle] pathForResource:@"filetoopen" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
Apple Surely approve , in here you can implement in two ways Apple肯定会批准 ,在这里你可以用两种方式实现
UIWebview UIWebView的
NSString *pathofFile = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"pdf"]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:pathofFile]]; [webView loadRequest:request];
UIDocumentInteractionController preferable for PDF UIDocumentInteractionController最适合PDF
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"sample" withExtension:@"pdf"]; if (URL) { // Initialize Document Interaction Controller self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL]; // Configure Document Interaction Controller [self.documentInteractionController setDelegate:self]; // Preview PDF [self.documentInteractionController presentPreviewAnimated:YES]; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.