美文网首页
3DTouch简单使用

3DTouch简单使用

作者: 月咏蝴蝶 | 来源:发表于2016-01-04 13:27 被阅读142次

最近看到有朋友试了一下3DTouch的功能,于是仿照他的代码也试着写了一下。原文链接:kaishener的博客

先上效果图

BB0256CFE39E8CA694C71EA5AEF8AE92.png
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    // Try 3DTouch Function
    UIApplicationShortcutIcon *icon1 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"login_account_icon"];
    UIApplicationShortcutIcon *icon2 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"login_pwd_icon"];
    UIApplicationShortcutIcon *icon3 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"login_check_icon"];
    UIApplicationShortcutItem *item1 = [[UIApplicationShortcutItem alloc] initWithType:@"item1" localizedTitle:@"账号" localizedSubtitle:@"点击账号" icon:icon1 userInfo:nil];
    UIApplicationShortcutItem *item2 = [[UIApplicationShortcutItem alloc] initWithType:@"item2" localizedTitle:@"密码" localizedSubtitle:@"点击密码" icon:icon2 userInfo:nil];
    UIApplicationShortcutItem *item3 = [[UIApplicationShortcutItem alloc] initWithType:@"item3" localizedTitle:@"验证码" localizedSubtitle:@"点击验证码" icon:icon3 userInfo:nil];
    application.shortcutItems = @[item1,item2,item3];
}
// 3DTouch Function Call Back
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler{
    if ([shortcutItem.type isEqualToString:@"item1"]) {
        NSLog(@"点击账号");
    }
    else if ([shortcutItem.type isEqualToString:@"item2"]){
        NSLog(@"点击密码");
    }
    else{
        NSLog(@"点击验证码");
    }
}

相关文章

  • 详解3DTouch的使用

    3DTouch的简单使用. 介绍 3DTouch是iOS9的时候出来,对硬件也有要求,也就是说只有iPhone6s...

  • 3DTouch简单使用

    最近看到有朋友试了一下3DTouch的功能,于是仿照他的代码也试着写了一下。原文链接:kaishener的博客 先...

  • 3DTouch 使用

    iOS9之后使用3DTouch 3DTouch功能主要分为两大块:主屏幕Icon上的Quick Action;Pe...

  • Swift中3DTouch的简单使用

    1.应用外3DTouch功能 就是给应用的桌面图标施加压力产生菜单功能,极大的提高应用使用的便捷性,更加快速定位到...

  • iOS 给App添加3DTouch功能

    给App添加3DTouch的多个Item 给某个页面添加3DTouch 3DTouch添加页面 预览页面

  • 添加3Dtouch功能其实很简单

    自从phone6s开始使用3Dtouch功能,有些公司的项目就要求加入这个功能。下面就和小伙伴们简单聊一下3Dto...

  • 3DTouch_IOS开发与应用

    3-DTouch_IOS 对集成3DTouch的简单讲解 Demo下载地址:https://github.com/...

  • Swift开发之3DTouch实用演练

    Swift开发之3DTouch实用演练 Swift开发之3DTouch实用演练

  • 3DTouch的使用

    1、创建3DTouch的两种方式 静态标签静态标签是我们在项目的配置plist文件中配置的标签,在用户安装程序后就...

  • 3DTouch 知识点详解

    下篇为大家提供一个3DTouch的简单Demo 增强版的Force Touch(压力触控)技术,Force Tou...

网友评论

      本文标题:3DTouch简单使用

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