【发布时间】:2011-06-29 12:10:06
【问题描述】:
有一段时间我正在努力创建一个自定义的钛模块。我正在尝试在其他应用程序中打开 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");
}
}
【问题讨论】:
-
经过更多测试后,确实创建了菜单但不可见。然后关闭应用程序并重新打开菜单可见。这似乎是底层 viewProxy 中的布局问题
标签: objective-c uidocumentinteraction titanium-modules