Can be loaded in a way more, for the time being summed up two kinds:
Locally piloted into a PDF file
Type 1: Load with UIWebView
UIWebView *webview = [[UIWebView alloc] Initwithframe:cgrectmake (00, Self.view.bounds.size.width, Self.view.bounds.size.height)]; [Self.view Addsubview:webview]; *path = [[NSBundle mainbundle] Pathforresource:@ " based on Apache+jmeter" ofType:@ " PDF"]; *url = [Nsurl Fileurlwithpath:path]; *request = [Nsurlrequest requestwithurl:url]; [WebView loadrequest:request];
Type 2: Frame Quicklook with preview file of the system
First import the frame quicklook.framework
Introducing Header Files #import <QuickLook/QuickLook.h>
Instantiating an Object
Qlpreviewcontroller *myqlpreviewcontroller = [[Qlpreviewcontroller alloc]init]; Myqlpreviewcontroller. delegate = self; = self; [Myqlpreviewcontroller Setcurrentpreviewitemindex: 0 ]; // Here you can go with the navigation bar, or you can jump without the navigation bar, you can also get the view to add [Self Presentviewcontroller:myqlpreviewcontroller animated:yes completion:^{ NSLog (@ " Jump Completion " ); }];
Declaring an agent
<QLPreviewControllerDelegate,QLPreviewControllerDataSource>
Implementation protocol
#pragma mark-qlpreviewcontroller agent-(Nsinteger) Numberofpreviewitemsinpreviewcontroller: (Qlpreviewcontroller *) controller{ return 1;} -(id<qlpreviewitem>) Previewcontroller: (Qlpreviewcontroller *) controller previewitematindex: (NSInteger) index{ NSString *path = [[NSBundle Mainbundle] pathforresource:@ "based on Apache+jmeter" oftype:@ "PDF"]; return [Nsurl Fileurlwithpath:path];} -(void) Previewcontrollerdiddismiss: (Qlpreviewcontroller *) controller{ NSLog (@ "Preview interface has disappeared");} File internal link Click No external jump-(BOOL) Previewcontroller: (Qlpreviewcontroller *) controller shouldopenurl: (nsurl *) URL Forpreviewitem: (id <QLPreviewItem>) item{ return NO;}
At this end, the loading process may be slow, after all, a local PDF file needs to be loaded;
Two ways to compare can be seen, the first kind of loading is more convenient, but the memory consumption of more, the second memory consumption of less, I actually measured the difference of 20MB (with the simulator).
Mark---------
IOS loading files in PDF format