我开始直接使用Swift开发应用程序,所以我几乎不知道有关Objective C的想法,但是我不得不接受一个在Objective C中实现并修复了一些bug的项目。
我在Swift中遇到了一个代码,我希望转换为Objective C
func mySpecialFunction(){
let importMenu = UIDocumentMenuViewController(documentTypes: [String(kUTTypePDF)], in: .import)
importMenu.delegate = self
importMenu.modalPresentationStyle = .formSheet
self.present(importMenu, animated: true, completion: nil)
}
现在我做了一些研究并得到了这个
UIDocumentMenuViewController *importMenu = *Code Here* ;
importMenu.delegate = self;
importMenu.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:importMenu animated:YES];
任何人都可以帮助我如何在代码中将第一行转换为Objective C?
答案 0 :(得分:-1)
请试试这个。
UIDocumentMenuViewController *importMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[(__bridge NSString*)kUTTypeContent] inMode:UIDocumentPickerModeImport];
答案 1 :(得分:-1)
UIDocumentMenuViewController *importMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.item", (__bridge NSString *) kUTTypeContent, (__bridge NSString *) kUTTypeData, (__bridge NSString *) kUTTypePackage, (__bridge NSString *) kUTTypeDiskImage, @"com.apple.iwork.pages.pages", @"com.apple.iwork.numbers.numbers", @"com.apple.iwork.keynote.key"] inMode:UIDocumentPickerModeImport];
使用上面的代码