I want to implement ParseUI login screen by subclassing PFLogInViewController. According to documentation, elements could be customized by changing the fields attribute (e.g. add Facebook login button). However, it does not work at all. Note that other customizations (e.g. color) works well.
I also tried to assign fields within init() instead of viewDidLoad(), did not work as well.
Thanks!!
import UIKit
import Parse
class LoginViewController: PFLogInViewController, PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate {
var appDelegate: AppDelegate {
return UIApplication.sharedApplication().delegate as AppDelegate
}
override func viewDidLoad() {
super.viewDidLoad()
if PFUser.currentUser() != nil {
println("login")
self.dismissViewControllerAnimated(true, completion: nil)
} else {
self.delegate = self
self.fields = (
PFLogInFields.UsernameAndPassword |
PFLogInFields.PasswordForgotten |
PFLogInFields.Facebook |
PFLogInFields.Twitter
)
self.logInView.backgroundColor = UIColor(rgba: "#FFFFFF")
self.logInView.tintColor = UIColor(rgba: "#FF2200")
self.signUpController.delegate = self
}
}
}
Try customizing the fields before you present LogInViewController
.