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
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
iOS開發(fā)Masonry與Frame布局差異示例詳解
這篇文章主要為大家介紹了iOS開發(fā)Masonry與Frame布局差異示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-11-11iOS中監(jiān)聽UITextField值改變事件的方法實例
UITextField 是一個用來處理文本輸入和現(xiàn)實的控件,在我們的開發(fā)當中也是經(jīng)常被用到。下面這篇文章主要給大家介紹了關于iOS中監(jiān)聽UITextField值改變事件的相關資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考下2018-07-07簡單談談c/c++中#import、#include和@class的區(qū)別
對于#import,我想做過iOS開發(fā)的人應該都不陌生。在開發(fā)過程中,當我們需要聲明某一個類時,都需要去引用。而#imclude的話,在我們學習C時就已經(jīng)知道了,他的作用也是引用聲明的意思。在表面上他們的作用似乎都是一樣的。但是在具體功能實現(xiàn)方式上,還是有著很大的區(qū)別。2018-01-01iOS App開發(fā)中UITextField組件的常用屬性小結
這篇文章主要介紹了iOS App開發(fā)中UITextField組件的常用屬性小結,文中還介紹了UITextField隱藏鍵盤及為內容增加校驗的兩個使用技巧,需要的朋友可以參考下2016-04-04