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

为TA充电
共{{data.count}}人
人已赞赏
iOS文章

iOS13适配和Xcode11.0踩坑小结

2021-5-19 13:51:27

iOS文章

iOS视频中断后台音乐播放的处理方法

2021-5-19 14:28:26

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索