栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 移动开发 > iOS

iOS指纹识别的简单应用

iOS 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/165803.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号