I'm currently implementing home screen Quick Actions for my iOS 9 app using 3D Touch. I have several actions using the existing System icons from the defined UIApplicationShortcutIconType enum.
An Example:
<dict> <key>UIApplicationShortcutItemIconType</key> <string>UIApplicationShortcutIconTypeSearch</string> <key>UIApplicationShortcutItemTitle</key> <string>Search for Parking</string> <key>UIApplicationShortcutItemType</key> <string>SEARCH</string> </dict>
However, for one of the actions I want to use a custom icon. I have tried replacing the UIApplicationShortcutItemIconType string with the name of my image asset, but that doesn't work.
It's easy enough to do for dynamic actions using UIApplicationShortcutIcon.iconWithTemplateImageName(), but this action needs to be static.
Quick actions are a great way to provide your users fast access to your app's common functionality within the home screen. iOS 13 introduced the concept of quick actions, where a user can touch and hold an app icon to display a set of shortcuts or actions to perform right from the home screen.
Instead of using the UIApplicationShortcutItemIconType key, replace it with the UIApplicationShortcutItemIconFile key and then supply the name of your image file or ImageAsset.
Like this:
<dict> <key>UIApplicationShortcutItemIconFile</key> <string>MyCustomImageName</string> </dict>
The rest of the keys can stay as they were.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With