7

我已经将 TouchID 合并到我的应用程序中LAContext,如下所示:

在此处输入图像描述

但是,我想将按钮标题的名称从“输入密码”更改为输入“输入安全码”(或类似的东西),如下所示:

在此处输入图像描述

我将如何更改该按钮标题?

这是LAContext 文档,这是我的代码:

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)")
        }
    }
}
4

2 回答 2

12

设置本地化的FallbackTitle 属性:

目标-C:

LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = @"YOUR TEXT HERE";

迅速:

var touchIDContext = LAContext()
context.localizedFallbackTitle = "YOUR TEXT HERE"
于 2015-01-22T18:01:16.007 回答
2

来自 Apple 文档,localizedCancelTitle适用于 iOS 10

// Fallback button title.
// @discussion Allows fallback button title customization. A default title "Enter Password" is used when
//             this property is left nil. If set to empty string, the button will be hidden.
@property (nonatomic, nullable, copy) NSString *localizedFallbackTitle;

// Cancel button title.
// @discussion Allows cancel button title customization. A default title "Cancel" is used when
//             this property is left nil or is set to empty string.
@property (nonatomic, nullable, copy) NSString *localizedCancelTitle NS_AVAILABLE(10_12, 10_0);
于 2016-10-19T07:17:02.883 回答