performSegue是在主屏幕顶部拉出第二个窗口,而不是要替换它吗?

时间:2020-04-11 01:26:03

标签: ios swift xcode viewcontroller

我试图让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
       }

   } 

0 个答案:

没有答案