2015-01-22 9 views
6

wechsle ich TouchID in meine app mit LAContext, wie so eingebaut haben:LAContext UIAlertController Taste Titel

enter image description here

aber ich wollte den Namen der Schaltfläche Titel von „Passwort eingeben“ ändern „Sicherheitscode eingeben“ (oder so ähnlich), wie folgt ein:

enter image description here

Wie würde ich mich über diesen Button Titel zu ändern?

Hier ist die LAContextdocumentation und hier ist mein 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)") 
     } 
    } 
} 
+0

für Sie meine Antwort Arbeit getan hat? –

+1

Yup, tat es. Ich setze deine Antwort richtig. –

+0

@Cody Hallo, teilen Sie uns bitte mit, wie Sie den Warnungstitel "Touch ID" auf "Touch ID for" ändern. XXXX "" – Balu

Antwort

11

die localizedFallbackTitle Eigenschaft Set:

Objective-C:

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

Swift:

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

nette Antwort ... ich frage mich, wie ich den Titel für Touch ID-Alarm ändern kann. z. B. "Touch ID für *********". Mein Text geht bei *******. – iAnurag

+0

@iAnnurag - eine Frage dazu stellen. (Und es ist klar, auch nicht, was du meinst ... –

+0

sowieso .. bekam ich die Antwort Danke trotzdem – iAnurag

0

Von Apple-Dokumentation ist localizedCancelTitle verfügbar für 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);