我目前正在使用3D Touch为我的iOS 9应用程序实现主屏幕快速操作.我使用定义的UIApplicationShortcutIconType枚举中的现有系统图标进行了多项操作.
一个例子:
<dict>
<key>UIApplicationShortcutItemIconType</key>
<string>UIApplicationShortcutIconTypeSearch</string>
<key>UIApplicationShortcutItemTitle</key>
<string>Search for Parking</string>
<key>UIApplicationShortcutItemType</key>
<string>SEARCH</string>
</dict>
Run Code Online (Sandbox Code Playgroud)
但是,对于其中一个操作,我想使用自定义图标.我尝试用我的图像资源的名称替换UIApplicationShortcutItemIconType字符串,但这不起作用.
使用UIApplicationShortcutIcon.iconWithTemplateImageName()对动态操作很容易,但此操作需要是静态的.