美文网首页
Lesson12 - 3DTouch

Lesson12 - 3DTouch

作者: 茗涙 | 来源:发表于2018-06-02 10:52 被阅读19次

    效果图

    3DTouch.gif

    项目代码地址

    代码块

    info.plist中添加,最多四个选项,及时添加超过四个也只会显示四个

    <key>UIApplicationShortcutItems</key>
        <array>
            <dict>
                <key>UIApplicationShortcutItemIconType</key>
                <string>UIApplicationShortcutIconTypeShare</string>
                <key>UIApplicationShortcutItemTitle</key>
                <string>Share</string>
                <key>UIApplicationShortcutItemType</key>
                <string>Share</string>
            </dict>
            <dict>
                <key>UIApplicationShortcutItemIconType</key>
                <string>UIApplicationShortcutIconTypeShare</string>
                <key>UIApplicationShortcutItemTitle</key>
                <string>Share0</string>
                <key>UIApplicationShortcutItemType</key>
                <string>Share0</string>
            </dict>
            <dict>
                <key>UIApplicationShortcutItemIconType</key>
                <string>UIApplicationShortcutIconTypeShare</string>
                <key>UIApplicationShortcutItemTitle</key>
                <string>Share1</string>
                <key>UIApplicationShortcutItemType</key>
                <string>Share1</string>
            </dict>
            <dict>
                <key>UIApplicationShortcutItemIconType</key>
                <string>UIApplicationShortcutIconTypeShare</string>
                <key>UIApplicationShortcutItemTitle</key>
                <string>Share2</string>
                <key>UIApplicationShortcutItemType</key>
                <string>Share2</string>
            </dict>
            <dict>
                <key>UIApplicationShortcutItemIconType</key>
                <string>UIApplicationShortcutIconTypeShare</string>
                <key>UIApplicationShortcutItemTitle</key>
                <string>Share3</string>
                <key>UIApplicationShortcutItemType</key>
                <string>Share3</string>
            </dict>
        </array>
    

    3DTouch回调方法

    //<UIApplicationShortcutItem: 0x6040004779c0; type: Share1, title: Share1>
    func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
    }
    

    相关文章

      网友评论

          本文标题:Lesson12 - 3DTouch

          本文链接:https://www.haomeiwen.com/subject/yuwksftx.html