我想添加「presentOpenInMenuFromRect」功能給Rhomobile。但是,我無法引用當前視圖。未定義的self.view爲presentOpenInMenuFromRect
的Rhomobile的功能(###標誌着我補充):
- (void)openDocInteractCommand:(NSString*)url {
if (NSClassFromString(@"UIDocumentInteractionController")) {
NSURL *fileURL = [NSURL fileURLWithPath:url];
UIDocumentInteractionController* docController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
docController.delegate = self;//[AppManager instance];
BOOL result = [docController presentPreviewAnimated:YES];
if (!result) {
###
BOOL isValid = [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
###
}
}
}
從本質上講,如果預覽失敗,我想打開「打開方式」菜單,因爲我; mtrying開.KMZ (Google地球KML文件),並且無法預覽。
完整的源代碼:https://github.com/rhomobile/rhodes/blob/master/platform/iphone/Classes/AppManager/AppManager.m
感謝,
尼克,
好吧,我是個新手。你能否告訴我們如何到達主窗口?我試過這個:BOOL isValid = [docController presentOpenInMenuFromRect:CGRectMake(300,300,100,100)inView:[Rhodes sharedInstance] .window animated:YES];但它給出了這個錯誤:***終止應用程序由於未捕獲的異常'NSGenericException',原因:' - [UIPopoverController dealloc]達到彈出仍然可見。' ---我從未見過「Open In ...」菜單。 – user2666194
@ user506706你可以使用[[UIApplication sharedApplication] keyWindow],但我認爲這不是很相關... :( – 2012-09-01 11:48:27
解決它使用此解決方案:http://stackoverflow.com/questions/12222940/undefined-self-查看目前打開的菜單很不錯 – user2666194