有一段时间我正在努力创建一个自定义的钛模块。我正在尝试在其他应用程序中打开 pdf。一切似乎都是正确的(没有警告等)但是在导航栏中按下按钮时没有显示菜单。
这是显示菜单的方法的代码:
ENSURE_SINGLE_ARG_OR_NIL(args,NSDictionary);
TiViewProxy* viewAnchor = [args objectForKey:@"view"];
NSString* fileToOpen = [args objectForKey:@"url"];
NSLog(@"%@",fileToOpen);
if(viewAnchor != nil){
NSLog(@"viewAnchor is not nil accessing controller");
NSLog(@"%@",[TiUtils toURL:fileToOpen proxy:self]);
CGRect rect = [TiUtils rectValue:args];
self.controller = [[UIDocumentInteractionController interactionControllerWithURL:[TiUtils toURL:fileToOpen proxy:self]] retain];
self.controller.delegate = self;
BOOL menuDisplayed = [self.controller presentOpenInMenuFromBarButtonItem:[viewAnchor barButtonItem] animated:YES];
//menuDisplayed = YES
if(menuDisplayed)
{
NSLog(@"Menu is displayed");
//This display's com.adobe.pdf
NSLog(@"%@",self.controller.UTI);
}
else
{
NSLog(@"Menu failed to display");
}
}