我试图让secondViewController在我(1)单击一个按钮并(2)验证条件之后出现。
在验证条件的if语句中,我使用performSegue来拉出secondViewController(“ dispenseScreen”)。但是,当我这样做时,它会弹出一个窗口,该窗口仅位于主屏幕的顶部,而不是替换它。
有人知道我要完全替换主屏幕需要做什么吗?
这是我的代码:
@IBAction func touchID(_ sender: Any)
{
let context:LAContext = LAContext()
//Removes Enter Password during failed TouchID
context.localizedFallbackTitle = ""
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
{
context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "We require your TouchID", reply: {(wasCorrect, error) in DispatchQueue.main.async {
self.isBiometryReady()
if wasCorrect {
self.performSegue(withIdentifier: "dispenseScreen", sender: self)
print("Correct")
}
else {
print("Incorrect")
}
}
})
} else {
//Enter phone password if too many login attempts
//Add message alerting user that TouchID is not enabled
}
}