3DTouch Demo
2015-10-29 19:45
381 查看
Demo下载链接: http://pan.baidu.com/s/1hqKxIx2 密码: kgfp
创建一个新的工程
配置info.plist文件
如下图
在 AppDelegate.h文件里面
AppDelegate.m文件
创建一个新的工程
配置info.plist文件
如下图
在 AppDelegate.h文件里面
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
AppDelegate.m文件
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [UIApplication sharedApplication].applicationIconBadgeNumber=0; return YES; } - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler{ //判断先前我们设置的唯一标识 if([shortcutItem.type isEqualToString:@"UITouchText.share"]){ NSArray *arr = @[@"hello 3D Touch"]; UIActivityViewController *vc = [[UIActivityViewController alloc]initWithActivityItems:arr applicationActivities:nil]; //设置当前的VC 为rootVC [self.window.rootViewController presentViewController:vc animated:YES completion:^{ }]; } else if ([shortcutItem.type isEqualToString:@"UITouchText.search"]) { UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"好想你" delegate:nil cancelButtonTitle:@"cancle" otherButtonTitles:@"sure", nil]; [alertView show]; } else if ([shortcutItem.type isEqualToString:@"UITouchText.look"]) { UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"温馨提示" delegate:nil cancelButtonTitle:@"cancle" destructiveButtonTitle:@"删除" otherButtonTitles:@"更多", nil]; [sheet showInView:self.window]; } else if ([shortcutItem.type isEqualToString:@"UITouchText.compose"]) { NSLog(@"UITouchText.compose"); } }
相关文章推荐
- vi编辑器的使用
- mysql数据库常用语句
- 10日冲刺第一日
- 【poj2342】Anniversary party
- 开源 iOS 项目分类索引大全
- 移动端web app研究
- nginx easy 安装&简单分发配置
- 静态关键字static和静态代码块、局部代码快、构造代码块
- 继电器驱动电路设计
- 书写高效的CSS
- LeetCode Search Insert Position (二分查找)
- MySQL Row size too large (> 8126) 以及ROW_FORMAT=COMPRESSED requires innodb_file_format > Antel 的解决办法
- JAVA类的继承学习笔记
- 指针和引用
- 文法分析
- javascript匿名函数自调用
- web前端开发工具
- PHP TSRM(线程安全管理)详解
- HTTP的请求和响应总结
- 全选