2016-04-24 45 views

回答

1

请看Apple的this reference。第一个代码示例为您提供了使用新的localizedTitle修改现有快速操作所需的内容。

下面是Apple示例中的Objective-C代码。总之,您创建了一个UIMutableApplicationShortcutItem,其中包含要修改的快捷方式项目的可变副本。更改标题,然后用新的替换上一个快捷方式。

NSArray <UIApplicationShortcutItem *> *existingShortcutItems = [[UIApplication sharedApplication] shortcutItems]; 
UIApplicationShortcutItem *anExistingShortcutItem = [existingShortcutItems objectAtIndex: anIndex]; 
NSMutableArray <UIApplicationShortcutItem *> *updatedShortcutItems = [existingShortcutItems mutableCopy]; 
UIMutableApplicationShortcutItem *aMutableShortcutItem = [anExistingShortcutItem mutableCopy]; 
[aMutableShortcutItem setLocalizedTitle: @“New Title”]; 
[updatedShortcutItems replaceObjectAtIndex: anIndex withObject: aMutableShortcutItem]; 
[[UIApplication sharedApplication] setShortcutItems: updatedShortcutItems]; 
+0

虽然此链接可能回答问题,但最好在此处包含答案的基本部分,并提供供参考的链接。如果链接页面更改,则仅链接答案可能会失效。 - [来自评论](/ review/low-quality-posts/12131735) – frasertweedale

+0

@frasertweedale我复制了Apple示例代码和一些说明文字。 – stevekohls

+0

@stevekohls谢谢!得到它的工作! –