Facebook登录按钮使文本字段不显示

时间:2019-07-19 19:26:51

标签: swift textfield

当我添加我的Facebook按钮时,我的TextFields不出现。

如果我在添加要添加的Facebook按钮的行中添加了注释,它们将正常显示。

let inputLogin = loginField
    inputLogin.frame.size = CGSize(width: view.bounds.size.width * 0.8, height: view.bounds.size.height * 0.075)
    inputLogin.center.x = self.view.bounds.width * 0.5
    inputLogin.center.y = self.view.bounds.height * 0.2
    inputLogin.layer.cornerRadius = 7
    inputLogin.layer.borderWidth = 1
    inputLogin.layer.borderColor = UIColor.black.cgColor
    self.view.addSubview(inputLogin)
    self.view.bringSubviewToFront(inputLogin)

    let inputPassword = passwordField
    inputPassword.frame.size = CGSize(width: view.bounds.size.width * 0.8, height: view.bounds.size.height * 0.075)
    inputPassword.center.x = self.view.bounds.width * 0.5
    inputPassword.center.y = self.view.bounds.height * 0.3
    inputPassword.layer.cornerRadius = 7
    inputPassword.layer.borderWidth = 1
    inputPassword.layer.borderColor = UIColor.black.cgColor
    self.view.addSubview(inputPassword)
    self.view.bringSubviewToFront(inputPassword)

let btnRegistrar = UIButton()
        btnRegistrar.frame.size = CGSize(width: view.bounds.size.width * 0.4, height: view.bounds.size.height * 0.075)
        btnRegistrar.center.x = self.view.bounds.width * 0.5 - btnRegistrar.frame.width * 0.6
        btnRegistrar.center.y = self.view.bounds.height * 0.4
        btnRegistrar.backgroundColor = UIColor.init(red: 100/255, green: 100/255, blue: 250/255, alpha: 1)
        btnRegistrar.layer.cornerRadius = 7
        btnRegistrar.layer.borderWidth = 1
        btnRegistrar.layer.borderColor = UIColor.black.cgColor
        btnRegistrar.setTitle("Registrar", for: .normal)
        btnRegistrar.setTitleColor(UIColor.black, for: .normal)
        self.view.addSubview(btnRegistrar)
        self.view.bringSubviewToFront(btnRegistrar)
        btnRegistrar.addTarget(self, action: #selector(registrarTapped), for: UIControl.Event.touchUpInside)

    let btnLogin = UIButton()
    btnLogin.frame.size = CGSize(width: view.bounds.size.width * 0.4, height: view.bounds.size.height * 0.075)
    btnLogin.center.x = self.view.bounds.width * 0.5 + btnLogin.frame.width * 0.6
    btnLogin.center.y = btnRegistrar.center.y
    btnLogin.backgroundColor = UIColor.init(red: 100/255, green: 100/255, blue: 250/255, alpha: 1)
    btnLogin.layer.cornerRadius = 7
    btnLogin.layer.borderWidth = 1
    btnLogin.layer.borderColor = UIColor.black.cgColor
    btnLogin.setTitle("Login", for: .normal)
    btnLogin.setTitleColor(UIColor.black, for: .normal)
    self.view.addSubview(btnLogin)
    self.view.bringSubviewToFront(btnLogin)
    btnLogin.addTarget(self, action: #selector(loginTapped), for: UIControl.Event.touchUpInside)

    let fbButton = FBLoginButton()
    fbButton.frame.size = CGSize(width: view.bounds.size.width * 0.5, height: view.bounds.size.height * 0.075)
    fbButton.center.x = self.view.bounds.width * 0.5
    fbButton.center.y = self.view.bounds.height * 0.8
    fbButton.permissions = ["public_profile", "email", "user_friends"]
    fbButton.delegate = self
    self.view.addSubview(fbButton)
    self.view.bringSubviewToFront(fbButton)

是否存在某种错误? 没有错误消息。

当我打开另一个也具有文本字段的视图时,它们都不显示。但是,如果我返回并再次打开它(第二次显示下一个视图),它们的确会出现...疯狂的错误...

0 个答案:

没有答案