1
2
3
4
|
documentController = [
UIDocumentInteractionController
interactionControllerWithURL:[
NSURL
fileURLWithPath:filePath]];
documentController.delegate =
self
;
documentController.UTI = @
"com.microsoft.word.doc"
;
[documentController presentOpenInMenuFromRect:CGRectMake(760, 20, 100, 100) inView:
self
.view animated:
YES
];
|
其中filePath为你要打开的文件路径,
UTI可以去
https://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
根据filePath文件后缀名去动态设置