首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LAContext更改UIAlertController按钮标题

LAContext更改UIAlertController按钮标题
EN

Stack Overflow用户
提问于 2015-01-22 17:56:01
回答 2查看 3.6K关注 0票数 7

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

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

我该怎么改变那个按钮的标题呢?

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

代码语言:javascript
复制
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)")
        }
    }
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-01-22 18:01:16

设置localizedFallbackTitle属性:

目标-C:

代码语言:javascript
复制
LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = @"YOUR TEXT HERE";

斯威夫特

代码语言:javascript
复制
var touchIDContext = LAContext()
context.localizedFallbackTitle = "YOUR TEXT HERE"
票数 12
EN

Stack Overflow用户

发布于 2016-10-19 07:17:02

从苹果文档中,localizedCancelTitle可用于iOS 10

代码语言:javascript
复制
// 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);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28095562

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档