Is it possible to create custom UIApplicationShortcutIcon? Or only the one given by apple ?
Custom UIApplicationShortcutIcon
Yes it is possible to UIApplicationShortcutIcon. According to docs:
There are three types of quick action icon:
An icon from a system-provided library of common types, as described in the UIApplicationShortcutIconType enumeration
An icon derived from a custom template image in your app’s bundle and preferably in an asset catalog
An icon representing a contact in the user's address book, which you access through the ContactsUI framework (see ContactsUI Framework Reference)
You can use iconWithTemplateImageName:
to intialiaze new button. Eg:
- (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;
}
Refer to Apple Docs.
© 2022 - 2024 — McMap. All rights reserved.