3D touch

Android原生Launcher3伪3D Touch分析 本文基于Android8.0上的原生Launcher3,分析了Android桌面的伪3D Touch实现。 阅读详情

#import "BSTableViewController.h"

#import "BSDetailViewController.h"



@interface BSTableViewController ()<</span>UIViewControllerPreviewingDelegate,BSDetailViewControllerDelegate>


@property (nonatomic,strong)NSMutableArray *items;

@property (nonatomic,weak)UITableViewCell *selectedCell;


@end


@implementation BSTableViewController


- (NSMutableArray *)items {

    if (!_items) {

        _items = [[NSMutableArray alloc]initWithObjects:@"one",@"two",@"three",@"four",@"five",@"six",@"seven",@"eight",nil];

    }

    return _items;

}



- (void)viewDidLoad {

    [super viewDidLoad];

    

//    self.tableView.backgroundColor = [UIColor greenColor];

    self.title = @"3DTouchDemo";

    self.tableView.rowHeight = 100;

    // 重要

   

    [self registerForPreviewingWithDelegate:self sourceView:self.view];

}


#pragma mark - UIViewControllerPreviewingDelegate


- (UIViewController *)previewingContext:(id<<span style="font-variant-ligatures: no-common-ligatures; color: #703daa">UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {

    

    NSIndexPath *indexPath = [self.tableView indexPathForCell:(UITableViewCell* )[previewingContext sourceView]];

//    NSLog(@"---%d",indexPath.row);

    

    

//    self.selectedCell = [self searchCellWithPoint:location];

//    previewingContext.sourceRect = self.selectedCell.frame;

    BSDetailViewController *detailVC = [[BSDetailViewController alloc] init];

    detailVC.delegate = self;

    detailVC.navTitle = self.selectedCell.textLabel.text;

    return detailVC;

}


- (void)previewingContext:(id<<span style="font-variant-ligatures: no-common-ligatures; color: #703daa">UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {

    NSLog(@"fads");

    [self tableView:self.tableView didSelectRowAtIndexPath:[self.tableViewindexPathForCell:self.selectedCell]];

}


// 根据一个点寻找对应cell并返回cell

- (UITableViewCell *)searchCellWithPoint:(CGPoint)point {

    UITableViewCell *cell = nil;

    for (UIView *view in self.tableView.subviews) {

        NSString *class = [NSString stringWithFormat:@"%@",view.class];

        if (![class isEqualToString:@"UITableViewWrapperView"]) continue;

        for (UIView *tempView in view.subviews) {

            if ([tempView isKindOfClass:[UITableViewCell class]] && CGRectContainsPoint(tempView.frame, point)) {

                cell = (UITableViewCell *)tempView;

                break;

            }

        }

        break;

    }

    return cell;

}


#pragma mark - BSDetailViewControllerDelegate

- (void)detailViewControllerDidSelectedBackItem:(BSDetailViewController*)detailVC {

    NSLog(@"back");

}


- (void)detailViewController:(BSDetailViewController *)detailVC DidSelectedDeleteItem:(NSString *)navTitle {

    [self.items removeObject:navTitle];

    [self.tableView reloadData];

}

#pragma mark - Table view data source


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;

}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.items.count;

}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *ID = @"cellid";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];

    if (!cell) {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];

//        [self registerForPreviewingWithDelegate:self sourceView:cell];

    }

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    

    cell.textLabel.text = self.items[indexPath.row];

    cell.detailTextLabel.text = [NSString stringWithFormat:@"%zd",indexPath.row + 1];

    

    return cell;

}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {

    

    

    BSDetailViewController *detailVC = [[BSDetailViewController alloc] init];

    detailVC.navTitle = self.items[indexPath.row];

    

    [self.navigationController pushViewController:detailVC animated:YES];

}


@end


// 版权属于原作者

// http://code4app.com (cn) http://code4app.net (en)

// 发布代码于最专业的源码分享网站: Code4App.com





//

//  BSDetailViewController.h

//  3DTouchDemo

//

//  Created by roki on 16/1/26.

//  Copyright © 2016年 roki. All rights reserved.

//


#import

@class BSDetailViewController;


@protocol BSDetailViewControllerDelegate <<span style="font-variant-ligatures: no-common-ligatures; color: #703daa">NSObject>


@required

// 删除按钮点击

- (void)detailViewController:(BSDetailViewController *)detailVC DidSelectedDeleteItem:(NSString *)navTitle;

// 返回按钮点击

- (void)detailViewControllerDidSelectedBackItem:(BSDetailViewController*)detailVC;


@end


@interface BSDetailViewController : UIViewController


@property (nonatomic,copy)NSString *navTitle;


@property (nonatomic,weak)id<</span>BSDetailViewControllerDelegate> delegate;


@end

// 版权属于原作者

// http://code4app.com (cn) http://code4app.net (en)

 

// 发布代码于最专业的源码分享网站: Code4App.com






//

//  BSDetailViewController.m

//  3DTouchDemo

//

//  Created by roki on 16/1/26.

//  Copyright © 2016年 roki. All rights reserved.

//


#import "BSDetailViewController.h"


@interface BSDetailViewController ()


@end


@implementation BSDetailViewController


- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];

    self.title = self.navTitle;

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(86,100, 200, 150)];

    imageView.image = [UIImage imageNamed:@"imageone"];

    UILabel *githubName = [[UILabel alloc] init];

    githubName.text = @"ITBigSea";

    githubName.textColor = [UIColor blueColor];

    githubName.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9alpha:1];

    githubName.frame = CGRectMake(136, 270, 100, 30);

    githubName.textAlignment = NSTextAlignmentCenter;

    

    [self.view addSubview:imageView];

    [self.view addSubview:githubName];

}


- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}


- (NSArray<<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2">id<<span style="font-variant-ligatures: no-common-ligatures; color: #703daa">UIPreviewActionItem>> *)previewActionItems {

    //

    UIPreviewAction *action1 = [UIPreviewAction actionWithTitle:@"删除"style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {

        if ([self.delegaterespondsToSelector:@selector(detailViewController:DidSelectedDeleteItem:)]) {

            [self.delegate detailViewController:selfDidSelectedDeleteItem:self.navTitle];

        }

    }];

    //

    UIPreviewAction *action2 = [UIPreviewAction actionWithTitle:@"返回"style:UIPreviewActionStyleDefault handler:^(UIPreviewAction * _Nonnull action, UIViewController * _Nonnull previewViewController) {

        if ([self.delegate respondsToSelector:@selector(detailViewControllerDidSelectedBackItem:)]) {

            [self.delegate detailViewControllerDidSelectedBackItem:self];

        }

    }];

    

    NSArray *actions = @[action1,action2];

    

    return actions;

}

@end



如果添加图标上的3d touch

则在appdelegate中添加如下代码


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

    // Override point for customization after application launch.

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[BSTableViewController alloc] init]];

    

    self.window.rootViewController = nav;

    

    // 动态添加快捷启动

    UIApplicationShortcutIcon *icon = [UIApplicationShortcutIcon iconWithType:UIApplicationShortcutIconTypeAlarm];

    UIApplicationShortcutItem *item = [[UIApplicationShortcutItem alloc] initWithType:@"shortcutTypeTwo" localizedTitle:@"two" localizedSubtitle:nil icon:icon userInfo:nil];

    [[UIApplication sharedApplication] setShortcutItems:@[item]];

    

    

    [self.window makeKeyAndVisible];

    return YES;

}


这是新增添的方法

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

    

    UINavigationController *nav = (UINavigationController *)self.window.rootViewController;

    BSDetailViewController *detailVC = [[BSDetailViewController alloc] init];

    

    if ([shortcutItem.type isEqualToString:@"shortcutTypeOne"]) {

        detailVC.navTitle = @"one";

        

    } else if ([shortcutItem.type isEqualToString:@"shortcutTypeTwo"]) {

        detailVC.navTitle = @"two";

    }

    

    [nav pushViewController:detailVC animated:YES];

}



关于3D Touch从app图标快速入口篇. 经过最近几天的研究,本人已经做出了一套快速入口的小demo,并且可以让模拟器进行3D Touch的快速入口效果. 一: 让模拟器可以测试3D Touch的快速入口效果步骤(本人也是在github上发现的方法,再次总结一下):  模拟器测试3D Touch的方法  1. 打开终端  2. git clone https://github.com/DeskConnect/SBSho 阅读详情

相关推荐

基于Swift的3D Touch技术应用实战:3DTouchScale开发全解析

在实际开发中,应对不同类型采取差异化策略:.down.up:适用于媒体控制类应用,映射为音量调节。.click:开启悬浮预览窗口,延迟加载内容。.pop:执行主导航动作,推入新页面。.deepPress:显示上下文菜单或确认对话框。建议采用策略模式组织处理逻辑:通过解耦处理逻辑,提升代码可维护性与测试便利性。(注:由于篇幅限制,此处仅展示前两个二级章节的完整内容。

weixin_42584758的博客 1012

3D touch的使用

使用3D touch的时候,你可以选择以静态的方式创建快捷方式(直接在info.plist中添加显示项),也可以创建动态的快捷方式,以动态方式创建的快捷方式,可以改变它的标题,子标题,和按钮图标。

王素燕 802

从零开始:使用英伟达nx开发板部署目标检测算法的全过程

英伟达nx开发板烧录、依赖安装、开发板联网

weixin_51192760的博客 3761

iOS 3D Touch开发tableview页面内的使用

上一次写了3DTouch在app icon的使用,时间隔了那么久,其实我早就写完了····就是一直忙着没时间 发表文章分享,也是对不住了~ 这篇文章讲的是3DTouch在页面内的使用  首先声明  childVC(3DTOUCH 的页面) @interface ViewController () { UITableView * table; NSArray * array;

伪随机的张三 2442

银河麒麟服务器操作系统V10 SP1:跨架构激活与设备更换无忧指南

本文详细解析了银河麒麟服务器操作系统V10 SP1的跨架构激活新特性。该特性彻底解除了授权与CPU架构的绑定,允许同一份授权在x86、ARM、龙芯等不同架构服务器间灵活使用。文章提供了从新设备激活到硬件更换后保持激活状态的全流程实战指南,并分享了内网环境部署等高级技巧,助力企业简化运维、提升硬件资源管理灵活性。

ff678的博客 348

软考软件评测师备考避坑指南:过来人告诉你这5个章节最容易丢分(附2024最新考纲解析)

本文为软考软件评测师考生提供备考避坑指南,深度解析5个高频失分章节,包括标准化与信息化基础、中间件技术、软件测试模型、白盒测试覆盖准则和性能测试指标。文章结合2024最新考纲,分享实战技巧和记忆口诀,帮助考生精准打击失分重灾区,提升备考效率。

weixin_29223603的博客 467

3D Touch swift 版本

OSX 10.10.5 (14F27) XCODE Version 7.1.1 (7B1005) swift -version --->Apple Swift version 2.1 (swiftlang-700.1.101.6 clang-700.1.76) AppDelegate.swift: // // AppDelegate.swift // 3DTouchDemo /

Johnson的专栏 731

TensorFlow GPU版本安装步骤-Windows系统

本文由在Windows下安装TensorFlow GPU版本教程-优快云等整理得到。 目录 1、确认显卡是否支持CUDA 1.1 查看显卡信息 打开“设备管理器”,查看显卡信息,如下图所示: 由上图知,本电脑的显卡为NVIDIA Quadro P400. 1.2 查看支持CUDA的显卡 网址:https://developer.nvidia.com/cuda-gpus 经查询可知,该显卡支持CUDA,如下图所示: 2、安装CUDA 2.1 下载CUDA 网址:https://developer.nvi

x_lingyun的专栏 764

3D Touch是什么?

3D Touch是什么 3D Touch介绍 转载地址:http://www.pc6.com/edu/84041.html 这是苹果在2015年秋季发布会上发布了iPhone 6S的新功能,除了类似Apple Watch、MacBook触摸板的标准、深压体验之外,iPhone 6s的触摸屏还将新增一种新层次的维度,实现更多操作体验。   3D Touch的功能很强大,轻点电话

1392

如何下载安装Qt各个版本?(2025-4-28更新)

本文将教您快速获取Qt各版本安装包!妈妈再也不用担心我找不到Qt安装包了!

程序区 5113

相机中的归一化实现讲解

本分讲解了图像处理中常出现的两个相机归一化操作

weixin_42102084的博客 1474

iOS开发 3D-touch使用

3D Touch的触控技术,被苹果称为新一代多点触控技术。3D Touch,苹果iPhone 6s的新功能,看起来类似 PC 上的右键。有Peek Pop 两种新手势。iOS 9提供了如下3D Touch APIs: Home Screen quick action API,使你可以给应用图标添加快速选项,从而让应用预料和加速其与APP的交互。UIKit peek a

FY_Fish的专栏 831

2篇1章1节:数据的基本概念以及 R 中的数据结构、向量与矩阵的创建及运算

本文详细介绍了R语言中常见的数据结构的向量和矩阵。通过掌握这些数据结构的基本概念和操作技巧,可以更高效地处理和分析数据。

MD Code 1243

android 简单模仿IOS的3D Touch功能

个人对IOS端3D Touch功能很感兴趣,想来自己实现,上网一搜,这类文章并不是很多,于是想自己实现一个。在自己绞尽脑汁的时候在github上搜索到一个开源项目可以实现简单3D Touch功能,在此坐一下笔记,以供后续参考。

路漫漫其修远兮,吾将上下而求索 2132

串口通信的性能瓶颈分析:如何提高数据吞吐量和降低延迟

摘要: 串口通信在高频或大数据场景下存在吞吐量不足、延迟高、丢帧等问题,主要瓶颈包括波特率限制、缓冲区不足、CPU轮询延迟等。优化策略包括:提升波特率至硬件上限、增大缓冲区、采用异步I/O(如ReadAsync)减少线程切换,使用二进制协议降低解析开销。实时性方面需启用硬件流控、批量发送数据,并优化线程优先级。跨平台适配需区分Windows/Linux的缓冲区设置与异步机制。性能测试可通过吞吐量、延迟及回环测试验证优化效果,核心原则是硬件匹配、异步处理、协议优化与跨平台适配。(150字)

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 980

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

iOS 3D Touch 简述

首先 有几个要知道的手势 第一, 在点击app icon 的手长按 并且用力一点(用点力不然没效果,不会弄坏手机,坏了也不是我的,哈哈!) 就会出现 几个Item。 第二,(1)在app 里面 长按 也要用力往下压 跟着就会可以弹出 自定义的 ViewController。这个时候如果你放...

chuangnizhen0989的博客 163

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

3D Touch

//1,桌面重压app图标 //需要在info.plist中进行配置 UIApplicationShortcutItems //数组可以设置多个选项 UIApplicationShortcutItemIconFile wt_unity_refreshing UIAp

baidu_32469997的博客 637

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

关于3D touch 一些简单实用

一、  3D touch简单使用,一般开发用到两种情况      1、在app图标上使用3D Touch;      2、在程序内使用3D Touch;            现在说一下第一种在app图标上使用3D Touch      这个一般也有两种方法去实现它         1)首先可以在info.plist 里面添加一些key在里面进行添加items

u014365593的博客 334

ios touch坐标_iOS 3D Touch –窥视与流行

ios touch坐标In this tutorial, we’ll be discussing and implementing the 3D Touch functionality in our iOS Application. 在本教程中,我们将在iOS应用程序中讨论和实现3D Touch功能。 窥视与流行 (Peek and Pop) Peek and Pop is a functio...

从零开始的教程世界 225

iPhone 神级功能,3D Touch 回归!!!

摘要:3DTouch曾是iPhone的"神级功能",通过压力感应实现分层操作,在称重和游戏中有独特体验。苹果2018年后取消该功能改用HapticTouch,虽降低成本但牺牲了体验。最新专利显示苹果可能研发光学压力检测技术,有望使3DTouch以新形式回归。这项技术可检测触摸位置、力度等多维信息,或应用于未来iPhone及AR/VR设备。

m0_55795221的博客 1871

iOS技术总结1——3D Touch技术

简介 3D Touch是iPhone 6s+,iOS9之后新增的功能。是一种立体触控技术,被苹果称为新一代多点触控技术,在Apple Watch上体现为采用了Force Touch,屏幕可感知不同的感压力度触控。有peek和pop两种新手势。3D-Touch技术相对于多点触摸在平面二维空间的操作,增加了对力度和手指面积的感知,其最大的好处在于不启动app的情况下,可以通过长按快速预览/查看你想要的...

baicai_520的专栏 490

3D—touch

点击打开链接

浅浅C的博客 447

3D Touch入门

在iOS 9中,新iPhone将第三维度添加到了用户界面。 用户现在可以用力摁下主屏按钮来快速调出应用提供的功能菜单。 在应用中,用户现在可以用力摁下视图以查看更多内容的预览并且快速访问一些功能。 想查阅示例代码的话,可以下载下面的Xcode工程: ApplicationShortcuts: Using UIApplicationShortc

风随花落的博客 551

iOS 检查手机的3D Touch是否可用

代码:   if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {        } 不能使用判断手机是否为6S或6SP,因为如果用户在设置 -> 通用 -> 3D Touch中将该功能关闭的话,同样forceTouch是不可用的. 而且此功能必须在运行时随时检查.因为用户

soindy 4906
上一篇: 设置UINavigationBar的UI
下一篇: iOS中delegate代理对象使用weak
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值