ios - LAContext 更改 UIAlertController 按钮标题

标签 ios swift uialertcontroller touch-id

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

enter image description here

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

enter image description here

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

这是 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";

swift :

var touchIDContext = LAContext()
context.localizedFallbackTitle = "YOUR TEXT HERE"

关于ios - LAContext 更改 UIAlertController 按钮标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28095562/

相关文章:

尝试添加文本字段时 iOS 8.3 UIAlertController 崩溃

ios - 在两个iOS设备之间发送视频的最佳方法是什么?

objective-c - IOS:用 UIImageView 填充 NSArray

ios - 获取 WKWebView 内某个区域的快照

ios - Apple 的 speakhere 项目,不同的 UI

ios - 显示 UILabel 的文本

arrays - swift中最通用的数据类型

ios - CoreGraphics 绘制结果到 CGContextDrawPath : invalid context 0x0

ios - 使用 UIAlertController 操作以编程方式链接到嵌入式 UIViewController

objective-c - 如何使用 UIAlertController 修复运行时错误