我的客戶報告了基本UIMenuController的一種奇怪行爲:當應用程序從應用商店安裝或臨時安裝時,UIMenuController不會顯示! 它在模擬器上工作得非常好,或者直接從xcode加載,但如果我嘗試分發完全相同的應用程序並通過應用商店或通過ipa文件安裝,菜單不會顯示。UImenucontroller在App Store上的行爲與開發時的行爲不同
這可能來自哪裏?
我不認爲這會有所幫助,但這裏是我用來顯示菜單控制器代碼:
UIMenuController *menuController;
NSAssert([self becomeFirstResponder], @"Sorry, UIMenuController will not work with %@ since it cannot become first responder", self);
UIMenuItem *duplicateItem = [[UIMenuItem alloc] initWithTitle:@"Duplicate" action:@selector(duplicate:)];
UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(deleteButton:)];
UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"Copy" action:@selector(copySelected:)];
[menuController setMenuItems:[NSArray arrayWithObjects:duplicateItem, deleteItem, copyItem, nil]];
[menuController setArrowDirection:UIMenuControllerArrowDown];
[menuController setTargetRect:sender.frame inView:contentView];
[menuController setMenuVisible:YES animated:YES];
和:
- (BOOL) canPerformAction:(SEL)selector withSender:(id) sender
{
return [super canPerformAction:selector withSender:sender];
}
Arg。沒有答案。我擔心...我在哪裏看? – Diwann