Can't get background to show on subclassed FUI

2019-08-17 17:32发布

问题:

So, I subclassed FUIAuthPickerViewController for customization purposes but I can't get the background to display. This started happening after updating Firebase pods to the latest version (was working fine on the previous version).

Here's my current set-up.

How I call it (from AppDelegate):

var authViewController = authUI.authViewController()
self.window!.rootViewController = authViewController
self.window!.makeKeyAndVisible()

My FUIAuth's delegate method (also in AppDelegate):

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

My subclass:

class AuthViewController: FUIAuthPickerViewController {

    var imgView: UIImageView!

    override func viewDidLoad() {
        super.viewDidLoad()

        let backgroundImage = #imageLiteral(resourceName: "MainBackground")
        imgView = UIImageView(image: backgroundImage)
        imgView.contentMode = .scaleAspectFill
        self.view.insertSubview(imgView, at: 0)
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        imgView.frame = self.view.bounds
    }
}

What it looks like:

If I change the line above from:

self.view.insertSubview(imgView, at: 0)

to

self.view.insertSubview(imgView, at: 1)

Then I can see the background and not the buttons:

My pods:

What am I missing here?

回答1:

See comments on GitHub issue for a workaround.