By creating a uidocumentinteractioncontroller to achieve this function, the following chestnuts are:
#pragma mark-Presentation file
-(void) Showdownloadfile: ( NSString * ) filename{
Get from the sandbox (the following path is the path I have stored from the network download file)
NSString *docpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory , Nsuserdomainmask , YES ) firstobject];
NSString *filedir = [nsstringstringwithformat:@ "%@/download/file" , DocPath];
NSString *filepath = [filedir stringbyappendingpathcomponent:@ " FileName"]; FileName such as: Text.jpg, text.pptx, text.mp4, etc.
Uidocumentinteractioncontroller * DOCC = [ self setupcontrollerwithurl: [nsurlfileurlwithpath : FilePath]
usingdelegate:self] ;
[docc presentOpenInMenuFromRect:self.view.bounds inView:self.view Animated:yes]; This method does not have a reading function
[docc presentpreviewanimated : YES ];
}
#pragma mark- set Doccontroller
-(uidocumentinteractioncontroller *) Setupcontrollerwithurl: (nsurl *) FileURL
usingdelegate: (ID <uidocumentinteraction Controllerdelegate>) interactiondelegate {
uidocumentinteractioncontroller *interactioncontroller = [ Uidocumentinteractioncontroller Interactioncontrollerwithurl : FileURL];
Interactioncontroller. Delegate = interactiondelegate;//Don't forget to abide by the uidocumentinteractioncontrollerdelegate Agreement
return Interactioncontroller;
}
#pragma mark-the parent window of the preview window, no display if not filled
-(uiviewcontroller *) Documentinteractioncontrollerviewcontrollerforpreview: ( Uidocumentinteractioncontroller *) controller{
return self;
}
#pragma mark-Proxy method
-(UIView *) Documentinteractioncontrollerviewforpreview: ( Uidocumentinteractioncontroller *) controller{
return self. View ;
}
-(cgrect) Documentinteractioncontrollerrectforpreview: ( Uidocumentinteractioncontroller *) controller{
return self. View . Frame ;
}
Offers several:
Http://pic6.nipic.com/20100330/4592428_113348097000_2.jpg
Http://lcell.bnu.edu.cn/upImages/resource/20110507140606.pptx
Http://120.25.226.186:32812/resources/videos/minion_01.mp4
Keep your essays in mind lest You forget
How iOS views and selects apps to open web-downloaded PDFs, word, JPG, MP4, and more