Ist es möglich, benutzerdefinierte UIApplicationShortcutIcon zu erstellen? Oder nur die von Apple?Benutzerdefiniert UIApplicationShortcutIcon
6
A
Antwort
11
Ja, es ist möglich, UIApplicationShortcutIcon. Laut docs:
Es gibt drei Arten von Schnellaktionssymbol:
Ein Symbol aus einem System bereitgestellte Bibliothek von gängigen Typen, wie
Eines in der UIApplicationShortcutIconType Aufzählung beschrieben Symbol abgeleitet aus einem benutzerdefinierten Vorlagenbild im Paket Ihrer App und vorzugsweise in einem Bestandskatalog
Ein Symbol, das einen Kontakt im Benutzer darstellt ‚S Adressbuch, mit dem Sie den ContactsUI Rahmen Zugriff durch (siehe ContactsUI Rahmen Referenz)
Sie iconWithTemplateImageName:
neue Schaltfläche intialiaze verwenden können. ZB:
- (void)createDynamicShortcutItems {
// create several (dynamic) shortcut items
UIApplicationShortcutItem *item1 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 1" localizedTitle:@"Item 1"];
UIApplicationShortcutItem *item2 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 2" localizedTitle:@"Item 2"];
UIApplicationShortcutItem *item3 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 3" localizedTitle:@"Item 3"];
// add all items to an array
NSArray *items = @[item1, item2, item3];
// add the array to our app
[UIApplication sharedApplication].shortcutItems = items;
}
Siehe Apple Docs.