ios9 -3dtouch 手势添加到app上

模拟器实现3dtouch参考以下网站:
http://my.oschina.net/u/2340880/blog/511509



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIApplicationShortcutIcon *icon1 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"app_c_s_1"]; UIApplicationShortcutIcon *icon2 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"app_c_s_2"]; UIApplicationShortcutIcon *icon3 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"app_c_s_3"]; UIMutableApplicationShortcutItem *item1 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"1" localizedTitle:@"One" localizedSubtitle:@"" icon:icon1 userInfo:nil]; UIMutableApplicationShortcutItem *item2 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"2" localizedTitle:@"Two" localizedSubtitle:@"" icon:icon2 userInfo:nil]; UIMutableApplicationShortcutItem *item3 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"3" localizedTitle:@"Three" localizedSubtitle:@"" icon:icon3 userInfo:nil]; NSArray *items = @[item1, item2, item3]; [UIApplication sharedApplication].shortcutItems = items; } - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { if([shortcutItem.type isEqualToString:@"1"]){ NSLog(@"执行代码1"); } else if ([shortcutItem.type isEqualToString:@"2"]) { NSLog(@"执行代码2"); } else if ([shortcutItem.type isEqualToString:@"3"]) { NSLog(@"执行代码3"); } }

 

 

 

 

 

posted @ 2015-11-24 17:43  曹县三胖暴打大猩猩  阅读(352)  评论(0编辑  收藏  举报