Skip to content

Instantly share code, notes, and snippets.

@nlutsenko
Created January 13, 2016 03:45
Show Gist options
  • Save nlutsenko/8b381a64e47726bf9dc1 to your computer and use it in GitHub Desktop.
Save nlutsenko/8b381a64e47726bf9dc1 to your computer and use it in GitHub Desktop.
///--------------------------------------
/// CustomLogInViewController.swift
///--------------------------------------
class CustomLogInViewController: PFLogInViewController {
var backgroundImage : UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// set our custom background image
backgroundImage = UIImageView(image: UIImage(named: "Icon"))
backgroundImage.contentMode = UIViewContentMode.ScaleAspectFill
self.logInView!.insertSubview(backgroundImage, atIndex: 0)
// remove the parse Logo
let logo = UILabel()
logo.text = "Butterfly"
logo.textColor = UIColor.whiteColor()
logo.font = UIFont(name: "Pacifico", size: 70)
logo.shadowColor = UIColor.lightGrayColor()
logo.shadowOffset = CGSizeMake(2, 2)
logInView?.logo = logo
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
backgroundImage.frame = CGRectMake( 0, 0, self.logInView!.frame.width, self.logInView!.frame.height)
}
}
///--------------------------------------
/// Using it
///--------------------------------------
func presentController() {
let logInViewController = CustomLogInViewController()
logInViewController.fields = [.Facebook, .Default]
logInViewController.delegate = self
logInViewController.emailAsUsername = false
logInViewController.facebookPermissions = ["public_profile", "email", "user_friends", "user_education_history", "user_birthday"]
logInViewController.signUpController?.delegate = self
presentViewController(logInViewController, animated: false, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment