我刚刚开始进入iOS开发,但我早期要做的就是在系统菜单中添加一个按钮,例如Dropbox在与电子邮件附件交互时添加了按钮。
此应用程序将用于视频,因此在快速播放器的共享菜单上添加按钮将是理想的。
我已经搜索了文档并且只找到了UIMenuItem类。这是我想要的还是有其他方法来实现这个功能?
答案 0 :(得分:2)
设置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];
}