2017-04-04 47 views
1

我想要註冊後警報控制器應該彈出,然後去loginFirstViewController但這不會發生,爲什麼?那就只反而loginfirstviewcontroller坡平了報警控制器UIAlertViewcontroller在去視圖控制器之前沒有被彈出

 if error == nil { 



       FIRAuth.auth()?.currentUser!.sendEmailVerification(completion: { (error) in 
       }) 



       print("You have successfully signed up") 
       //Goes to the Setup page which lets the user take a photo for their profile picture and also chose a username 




       let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert) 


       let alertActionOkay = UIAlertAction(title: "Okay", style: .default) 

        let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController") 

        self.present(vc!, animated: true, completion: nil) 



        alertController.addAction(alertActionOkay) 

       self.present(alertController, animated: true, completion: nil) 

       } 
+0

要naviget到另一個VC,如果用戶點擊OK按鈕,否則 –

+1

您的viewController之前的ViewController呈現alertController呈現。您可以嘗試在警報推送新視圖控制器的好行爲時在前一個控制器上顯示警報。 –

回答

3

您直接打開新的視圖 - 控制,以防止這一點,你應該添加完成處理程序uialertaction的。當用戶按下OK按鈕就可以打開其他視圖 - 控制

let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert) 
    let alertActionOkay = UIAlertAction(title: "Okay", style: .default) { (action) in 
     let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController") 
     self.present(vc!, animated: true, completion: nil) 
    } 
    alertController.addAction(alertActionOkay) 
    self.present(alertController, animated: true, completion: nil) 
+0

thankyousomuch親愛的 –

相關問題