Reputation: 2989
I've incorporated TouchID into my app with LAContext
, like so:
However, I'm wanting to change the name of the button title from "Enter Password" to enter "Enter Security Code" (or something like that), like this:
How would I go about changing that button title?
Here's the LAContext
documentation and here's my code:
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)")
}
}
}
Upvotes: 7
Views: 3851
Reputation: 6524
From Apple Documentation, localizedCancelTitle
is available for 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);
Upvotes: 2
Reputation: 8741
Set the localizedFallbackTitle property:
Objective-C:
LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = @"YOUR TEXT HERE";
Swift:
var touchIDContext = LAContext()
context.localizedFallbackTitle = "YOUR TEXT HERE"
Upvotes: 12