码迷,mamicode.com
首页 > 其他好文 > 详细

3D touch

时间:2017-03-13 12:33:42      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:shortcut   handle   options   can   detail   mac   ide   handler   http   

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    

    //判断是否支持3D Touch功能

    if (self.window.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {

        // 动态添加标签

        UIApplicationShortcutIcon *icon = [UIApplicationShortcutIcon iconWithTemplateImageName:@"扫码图标"];

        UIApplicationShortcutItem *shortItem1 = [[UIApplicationShortcutItem alloc] initWithType:@"扫码" localizedTitle:@"扫码" localizedSubtitle:nil icon:icon userInfo:nil];

        NSArray *shortItems = [[NSArray alloc] initWithObjects:shortItem1, nil];

        NSLog(@"%@", shortItems);

        [[UIApplication sharedApplication] setShortcutItems:shortItems];

    }

    

    return YES;

}

 

- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler{

    if ([shortcutItem.localizedTitle  isEqual: @"扫码"]) {

        

        NSLog(@"打开扫码界面");

        

        ViewController *controller = (ViewController *)self.window.rootViewController;

        [controller goScanne];

        

        return;

    }

}

 

其他链接:

http://blog.csdn.net/a416863220/article/details/51217465

 

 

 

3D touch

标签:shortcut   handle   options   can   detail   mac   ide   handler   http   

原文地址:http://www.cnblogs.com/daxueshan/p/6542028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!