我刚刚进入 iOS 开发,但我必须尽早做的是向系统菜单添加一个按钮,例如 Dropbox 在与电子邮件附件交互时如何添加其按钮。
此应用程序将用于视频,因此在快速播放器的共享菜单上添加一个按钮将是理想的。
我搜索了文档,只找到了 UIMenuItem 类。这是我想要的还是有其他方法来实现这个功能?
我刚刚进入 iOS 开发,但我必须尽早做的是向系统菜单添加一个按钮,例如 Dropbox 在与电子邮件附件交互时如何添加其按钮。
此应用程序将用于视频,因此在快速播放器的共享菜单上添加一个按钮将是理想的。
我搜索了文档,只找到了 UIMenuItem 类。这是我想要的还是有其他方法来实现这个功能?
设置 project-info.plist -> 添加新项目 (UTExportedTypeDeclarations)
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.quicktime-movie</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.company.project</string>
<key>UTTypeTagSpecification</key>
<dict/>
</dict>
</array>
在 .m 文件中编码 ButtonClick 事件
-(IBAction)actionClick:(id)sender{
UIDocumentInteractionController *documentController =
[UIDocumentInteractionController interactionControllerWithURL:
[NSURL fileURLWithPath:MOVIE_FILE_PATH]];
documentController.delegate = self;
documentController.UTI = @"com.apple.quicktime-movie";
[documentController presentOpenInMenuFromRect:CGRectZero
inView:self.view
animated:YES];
}