iOS FirebaseUI登录自定义

时间:2019-06-27 15:39:22

标签: swift firebase firebase-authentication firebaseui

我正在尝试自定义FirebaseUI登录-但没有更改。

我有一个图标-登录,用户将单击该图标进入登录屏幕-

guard let authUI = FUIAuth.defaultAuthUI() else { return }
            authUI.delegate = self
            let providers: [FUIAuthProvider] = [
                FUIGoogleAuth(),
                FUIEmailAuth(),
                FUIFacebookAuth()
            ]
            authUI.providers = providers
            authUI.tosurl = URL(string: "hi")
            authUI.privacyPolicyURL = URL(string: "pwned")
            let authViewController = authUI.authViewController()
            self.present(authViewController, animated: true, completion: nil)

然后,自定义登录的说明是在FirebaseAuthDelegate的委托中创建自定义viewcontroller-

func authPickerViewController(forAuthUI authUI: FUIAuth) -> FUIAuthPickerViewController {
        return AuthenicationViewController(authUI : authUI)
    }

然后我尝试在自定义viewcontroller中更改背景的颜色-

class AuthenicationViewController: FUIAuthPickerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = UIColor.black

    }
}

我也尝试添加图像,但是它也不起作用。我在这里想念东西吗?

1 个答案:

答案 0 :(得分:0)

您可以将自定义.xib与

一起使用
    func authPickerViewController(forAuthUI authUI: FUIAuth) -> FUIAuthPickerViewController {
    return AuthenicationViewController(nibName: "YourCustomPickerXIB",
        bundle: Bundle.main,
        authUI: authUI)
}

您可以使用sample on repo

进行自定义

PD:您在AuthenicationViewController上输入错字了。