从帮助菜单中删除

从帮助菜单中删除

本文介绍了从帮助菜单中删除(或自定义)“搜索"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序具有默认的帮助"菜单.我已经删除了帮助"条目,并添加了一个支持条目,该条目链接到我网站上的一个论坛.

My app has the default 'Help' menu. I have removed the 'Help' entry and added a Support entry that links to a forum on my website.

帮助菜单笔尖看起来像这样:

The help menu nib looks like this:

但是一旦我启动了应用程序并运行了一个新菜单项,它就会被吸住:

But once I have the app up and running a new menu item has been suck in:

如何使搜索消失? (甚至更好的是,如何使它使用诸如 http://mywebsite.com/support?search = XXXXX ).

How can I make the search go away? (Or even better, how could I make it launch a url with params such as http://mywebsite.com/support?search=XXXXX).

推荐答案

您正在寻找 NSUserInterfaceItemSearching 协议.返回一个搜索结果项,并使用它来打开您的自定义URL.

You're looking for NSUserInterfaceItemSearching protocol.Return a single search result item and use it to open your custom URL.

- (void)searchForItemsWithSearchString:(NSString *)searchString resultLimit:(NSInteger)resultLimit matchedItemHandler:(void (^)(NSArray *items))handleMatchedItems
{
    handleMatchedItems(@[searchString]);
}

- (NSArray *)localizedTitlesForItem:(id)item
{
    return @[[NSString stringWithFormat:@"Search for '%@' on my website", [item description]]];
}

- (void)performActionForItem:(id)item
{
    // Open your custom url assuming item is actually searchString
}

这篇关于从帮助菜单中删除(或自定义)“搜索"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:29