iOS指纹识别的简单应用
更新时间:2020年07月01日 08:40:39 作者:青灯古魔
这篇文章主要为大家详细介绍了iOS指纹识别的简单应用,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
指纹识别(Touch ID)的简单应用,供大家参考,具体内容如下
1、调用
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self setupNotification]; UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; [button setTitle:@"点击调用" forState:UIControlStateNormal]; [button addTarget:self action:@selector(actionDidClickButton:) forControlEvents:UIControlEventTouchUpInside]; [button setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal]; [self.view addSubview:button]; } - (void)actionDidClickButton:(UIButton *)sender { [self touchIDTest]; } - (void)touchIDTest { [TouchIDManager validateTouchID]; } - (void)setupNotification { [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDSuccess) name:ValidateTouchIDSuccess object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotAvailable) name:ValidateTouchIDNotAvailable object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotEnrolled) name:ValidateTouchIDNotEnrolled object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDAuthenticationFailed) name:ValidateTouchIDAuthenticationFailed object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDCancel) name:ValidateTouchIDCancel object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionTouchIDLockout) name:ValidateTouchIDLockout object:nil]; } - (void)actionDidReceiveValidateTouchIDSuccess { NSLog(@"%s",__func__); } - (void)actionDidReceiveValidateTouchIDNotAvailable { NSLog(@"%s",__func__); } - (void)actionDidReceiveValidateTouchIDNotEnrolled { NSLog(@"%s",__func__); } - (void)actionDidReceiveValidateTouchIDAuthenticationFailed { NSLog(@"%s",__func__); } - (void)actionDidReceiveValidateTouchIDCancel { NSLog(@"%s",__func__); } - (void)actionTouchIDLockout { NSLog(@"%s",__func__); } - (void)dealloc { [[NSNotificationCenter defaultCenter]removeObserver:self]; }
具体demo
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
简单谈谈c/c++中#import、#include和@class的区别
对于#import,我想做过iOS开发的人应该都不陌生。在开发过程中,当我们需要声明某一个类时,都需要去引用。而#imclude的话,在我们学习C时就已经知道了,他的作用也是引用声明的意思。在表面上他们的作用似乎都是一样的。但是在具体功能实现方式上,还是有着很大的区别。2018-01-01iOS App开发中UITextField组件的常用属性小结
这篇文章主要介绍了iOS App开发中UITextField组件的常用属性小结,文中还介绍了UITextField隐藏键盘及为内容增加校验的两个使用技巧,需要的朋友可以参考下2016-04-04
最新评论