我已经使用LAContext将TouchID合并到我的应用程序中,如下所示:
但是,我想要从“输入密码”更改按钮标题的名称,以输入“输入安全代码”(或类似的东西),如下所示:
如何更改按钮标题?
这是LAContext documentation,这是我的代码:
var touchIDContext = LAContext() if touchIDContext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics,error: &msgError) { touchIDContext.evaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics,localizedReason: touchIDMessage) { (success: Bool,error: NSError!) -> Void in if success { println("Success") } else { println("Error: \(error)") } } }
解决方法
设置localizedFallbackTitle属性:
Objective-C的:
LAContext *context = [[LAContext alloc] init]; context.localizedFallbackTitle = @"YOUR TEXT HERE";
迅速:
var touchIDContext = LAContext() context.localizedFallbackTitle = "YOUR TEXT HERE"