ios使用3dD Touch Screen Short Cut
2016-01-25 15:52
323 查看
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
if (IOS9_OR_LATER) {
[self
shortCut];
}
}
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem
*)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler
{
if ([shortcutItem.type
isEqualToString:@"searchItem"]) {
SearchViewController *room = [[SearchViewController alloc] init];
[baseNav pushViewController:room animated:YES];
}
if ([shortcutItem.type isEqualToString:@"icon_recharge"])
{
RechargeViewController *room = [[RechargeViewController alloc] init];
[baseNav pushViewController:room animated:YES];
}
}
//3d touch screen short cut
- (void) shortCut
{
NSArray * typeArray =@[@"searchItem",@"rechargeItem"];//key类型
NSArray * titleArray =
@[@"搜索",@“充值”];//标题
//图标名字,项目资源中的图标名称
NSArray * imageNameArray =@[@"icon_search",@"icon_recharge"];
NSMutableArray * itemArray = [[NSMutableArray
alloc] init];
for (int i=0; i<typeArray.count;
i++) {
UIApplicationShortcutIcon * icon = [UIApplicationShortcutIcon
iconWithTemplateImageName:imageNameArray[i]];
UIMutableApplicationShortcutItem * item = [[UIMutableApplicationShortcutItem
alloc] initWithType:typeArray[i]
localizedTitle:titleArray[i]
localizedSubtitle:@""
icon:icon userInfo:nil];
[itemArray addObject:item];
}
[UIApplication
sharedApplication].shortcutItems = itemArray;
}
*)launchOptions
{
if (IOS9_OR_LATER) {
[self
shortCut];
}
}
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem
*)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler
{
if ([shortcutItem.type
isEqualToString:@"searchItem"]) {
SearchViewController *room = [[SearchViewController alloc] init];
[baseNav pushViewController:room animated:YES];
}
if ([shortcutItem.type isEqualToString:@"icon_recharge"])
{
RechargeViewController *room = [[RechargeViewController alloc] init];
[baseNav pushViewController:room animated:YES];
}
}
//3d touch screen short cut
- (void) shortCut
{
NSArray * typeArray =@[@"searchItem",@"rechargeItem"];//key类型
NSArray * titleArray =
@[@"搜索",@“充值”];//标题
//图标名字,项目资源中的图标名称
NSArray * imageNameArray =@[@"icon_search",@"icon_recharge"];
NSMutableArray * itemArray = [[NSMutableArray
alloc] init];
for (int i=0; i<typeArray.count;
i++) {
UIApplicationShortcutIcon * icon = [UIApplicationShortcutIcon
iconWithTemplateImageName:imageNameArray[i]];
UIMutableApplicationShortcutItem * item = [[UIMutableApplicationShortcutItem
alloc] initWithType:typeArray[i]
localizedTitle:titleArray[i]
localizedSubtitle:@""
icon:icon userInfo:nil];
[itemArray addObject:item];
}
[UIApplication
sharedApplication].shortcutItems = itemArray;
}
相关文章推荐
- 在iOS开发中使用FMDB
- iOS ViewController里代码结构的规定
- iOS:Xcode7下创建 .a静态库 和 .framework静态库
- 【同行说技术】iOS从小白到大神必读资料汇总(四)
- iOS--利用比例纯代码适配屏幕大小
- IOS7 点击空白处隐藏键盘的几种方法
- 苹果开发者账号那些事儿(三)
- iOS 通知notification
- 在iOS7之后修改状态栏字体的颜色
- 浅析iOS开发者应用程序开发工具套件-iOS SDK
- ios高效开发-如何正确使用const,static,extern
- 苹果开发者账号那些事儿(二)
- iOS 崩溃调试 exc_bad_access(code=1,address=0x10)
- 苹果开发者账号那些事儿(一)
- ios runtime之深入浅出 Cocoa 消息
- iOS 根据 crash 崩溃 报告的内存地址定位到代码位置
- 在iTunes Connect查看崩溃日志
- iOS开发之Cocoa框架详解
- iOS--当cell上显示不同数量图片的时候重用
- iOS--当cell上显示不同数量图片的时候重用