我在UIWebView
中創建了自定義UIMenuController
,但在此之後它似乎擺脫UIMenuController
中的「說話選擇」選項。說話選擇選項在所有測試設備上的「首選項」中打開,並出現在其他應用程序中,包括非Apple應用程序。有沒有無障礙服務或sharedMenuController
的一部分,我可以打電話來獲得這個項目?將語音添加到自定義UIMenuController
UIMenuItem *copyMenuItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"Copy menu item") action:@selector(myappCopy:)];
UIMenuItem *highlightMenuItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Highlight", @"Highlight menu option") action:@selector(myappHighlight:)];
UIMenuItem *unhighlightMenuItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Remove Highlight", @"Remove Highlight menu option")
action:@selector(myappRemoveHighlight:)];
UIMenuItem *noteMenuItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Note", @"Note menu options") action:@selector(myappNote:)];
[UIMenuController sharedMenuController].menuItems = [NSArray arrayWithObjects:copyMenuItem, highlightMenuItem, unhighlightMenuItem, noteMenuItem, nil];
[copyMenuItem release];
[highlightMenuItem release];
[unhighlightMenuItem release];
[noteMenuItem release];
我甚至試圖在開始時解析現有的共享菜單項,但我沒有看到任何東西傾倒在日誌中。該方法在應用程序啓動時被調用。
在方法的頂部試過這樣:
for (UIMenuItem *menuItem in [UIMenuController sharedMenuController].menuItems) {
NSLog(@"title: %@", menuItem.title);
NSLog(@"action: %@", menuItem.action);
}
任何幫助,非常感謝!謝謝 - 埃裏克
底線......所以我發現在方法開始時UIMenuController項目數組的數量爲0,所以for循環毫無意義。 – 2012-03-27 14:42:32
我只想知道,有誰知道如何訪問默認的UIMenuController項目並將它們包含在菜單項中? – 2012-03-27 14:43:03
我已將此作爲雷達提交:12931434。您是否可以通過下面的解決方案獲得應用商店的批准? – 2012-12-24 16:27:47