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
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。
相關文章:
1. ThinkPHP5 通過ajax插入圖片并實時顯示(完整代碼)2. ASP.NET MVC通過勾選checkbox更改select的內容3. Android實現圖片自動切換功能(實例代碼詳解)4. jsp+mysql實現網頁的分頁查詢5. Python使用oslo.vmware管理ESXI虛擬機的示例參考6. 存儲于xml中需要的HTML轉義代碼7. javascript xml xsl取值及數據修改第1/2頁8. 解決Python paramiko 模塊遠程執行ssh 命令 nohup 不生效的問題9. JavaScript Tab菜單實現過程解析10. 使用AJAX(包含正則表達式)驗證用戶登錄的步驟
