LAContext change the name of the UIAlertController button

I have included TouchID in my application using LAContext , for example:

enter image description here

However, I want to change the name of the button name from "Enter Password" to enter "Enter Security Code" (or something like that), for example:

enter image description here

How do I change the name of this button?

Here is the LAContext documentation and here is 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)") } } } 
+6
source share
2 answers

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" 
+11
source

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); 
0
source

Source: https://habr.com/ru/post/981412/


All Articles