小编Chr*_*ein的帖子

如何在iOS 9应用程序中为静态UIApplicationShortcutItem指定自定义图标?

我目前正在使用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()对动态操作很容易,但此操作需要是静态的.

ios ios9 3dtouch uiapplicationshortcutitem

28
推荐指数
2
解决办法
1万
查看次数

标签 统计

3dtouch ×1

ios ×1

ios9 ×1

uiapplicationshortcutitem ×1