搜索
您的当前位置:首页正文

swift3.0 给app图标添加 3D touch

来源:二三娱乐
image.png

1.在 info.plist文件中添加

<key>UIApplicationShortcutItems</key>
    <array>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeShare</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>My MemberShip</string>
            <key>UIApplicationShortcutItemType</key>
            <string>Share17Hi</string>
        </dict>
    </array>
    func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
        
        switch shortcutItem.type {
        case "Share17Hi":
            print("Do what u want")
        default:
            break
        }
    }
Top