Home>

I am a super beginner.

If present modally is selected when connecting Segue, the screen after the transition will be as follows.
I want you to tell me how to solve it.

(It's just a normal move to the photo screen when you press the Login button.)

Thank you.

Applicable source code
import UIKit
import Firebase
var auth: Auth!
class AccountViewController: UIViewController {

    @IBOutlet var emailTextField: UITextField!
    @IBOutlet var passwordTextField: UITextField!
    @IBOutlet var usernameTextField: UITextField!

    override func viewDidLoad () {
        super.viewDidLoad ()
        auth = Auth.auth ()
        emailTextField.delegate = self
        passwordTextField.delegate = self
        usernameTextField.delegate = self
    }

    @IBAction func registerAccount (_ sender: Any) {
        let email = emailTextField.text!
        let password = passwordTextField.text!
        let username = usernameTextField.text!
        auth.createUser (withEmail: email, password: password) {(result, error) in
            if error == nil, let result = result {
                self.performSegue (withIdentifier: "Timeline", sender: result.user)
            }
        }
    }
}
// The delegate method is described separately by extension for readability.
extension AccountViewController: UITextFieldDelegate {
    func textFieldShouldReturn (_ textField: UITextField)->Bool {
        textField.resignFirstResponder ()
        return true
    }
}
  • Answer # 1

    I recommend adding the following to

    AccountViewController.

    override func prepare (for segue: UIStoryboardSegue, sender: Any?) {
            segue.destination.modalPresentationStyle = .fullScreen
        }

    Please refer here for details.

    https://StackOverflow.com/questions/224705#reply-328891

Related articles