iOS安全

UIDocumentInteractionController的

2016-07-01  本文已影响2235人  跬步千里_LenSky

这个需要在真机才有效哦!

最近在做文件使用第三方应用查看的功能 同事介绍了这个类 但是一直没用  跟AirDrop长得很像 这个也可以进行AirDrop蓝牙分享很强大的功能

//注意事项  _documentController 对象因为不是使用alloc创建的所以要使用强引用要不然会崩溃

/代理为 < UIDocumentInteractionControllerDelegate>

_documentController =[UIDocumentInteractionController   interactionControllerWithURL:fileURL];

_documentController.delegate = self;

[_documentController presentOpenInMenuFromRect:CGRectZero

inView:self.view

animated:YES];

-(void)documentInteractionController:(UIDocumentInteractionController *)controller

willBeginSendingToApplication:(NSString *)application

{

//将要发送的应用

}

//下面是他的代理方法

-(void)documentInteractionController:(UIDocumentInteractionController *)controller

didEndSendingToApplication:(NSString *)application

{

//已经发送的应用

}

-(void)documentInteractionControllerDidDismissOpenInMenu:

(UIDocumentInteractionController *)controller

{

}

运行效果=========================================

上一篇 下一篇

猜你喜欢

热点阅读