Parse-SDK-iOS-OSX icon indicating copy to clipboard operation
Parse-SDK-iOS-OSX copied to clipboard

PFSignUpViewController Additional Field

Open jschwartzmtn opened this issue 5 years ago • 7 comments

I'm trying to capture users' full names at sign up. I've subclassed PFSignUpViewController and in viewDidLoad() I have the following:

self.fields = [.usernameAndPassword, .dismissButton, .signUpButton, .additional]

However when the SignUpViewController loads, only the username & password fields show up. I am able to make other customizations (button colors, background and logo images, etc.). At runtime, signUpView.additionalField is nil.

I also tried forcing the additional field to be enabled using

signUpView.additionalField.isEnabled = true

but this did not change anything. Interestingly, if I do this:

self.fields = [.dismissButton, .signUpButton, .additional]

The username and password fields still show up and the rawValue of signupView.fields does not change (the rawValue is 27 regardless of what I include in the fields array).

There isn't much documentation around this, so any help that can be provided would be awesome (and should probably be added to the documentation for future use).

jschwartzmtn avatar May 02 '19 20:05 jschwartzmtn

Thank you

ShawnBaek avatar May 11 '19 15:05 ShawnBaek

Can you share your full PFSignUpViewController configuration? - I can’t replicate this right now

TomWFox avatar May 25 '19 16:05 TomWFox

Sure,

I have a very simple subcalsss of PFSignUpViewController:

import UIKit
import Parse

class SignUpViewController : PFSignUpViewController {
    
    var backgroundImage : UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.emailAsUsername = true
        self.modalTransitionStyle = .flipHorizontal
        
        self.fields = [PFSignUpFields.usernameAndPassword, PFSignUpFields.dismissButton, PFSignUpFields.signUpButton, PFSignUpFields.additional]
        signUpView?.additionalField?.placeholder = "Full Name"
        signUpView?.additionalField?.isEnabled = true
        
        let nameField = PFTextField(frame: CGRect(x: 0, y: signUpView!.signUpButton!.frame.origin.y + signUpView!.signUpButton!.frame.height + 16.0,  width: signUpView!.usernameField!.frame.width, height: signUpView!.usernameField!.frame.height))
        signUpView?.insertSubview(nameField, at: 1)

        backgroundImage = UIImageView(image: UIImage(named: "bg"))
        backgroundImage.contentMode = .bottom
        signUpView?.insertSubview(backgroundImage, at: 0)
        signUpView?.signUpButton!.setBackgroundImage(nil, for: .normal)
        signUpView?.signUpButton!.backgroundColor =  Constants.orangeColor
        signUpView?.dismissButton!.setTitle("Already signed up?", for: .normal)
        signUpView?.dismissButton!.setImage(nil, for: .normal)
        
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        backgroundImage.frame = signUpView!.frame
        signUpView!.logo = UIImageView(image: UIImage(named: "logo"))
        signUpView!.logo!.frame = CGRect(x: 0, y: 200, width: signUpView!.frame.width, height: 113)
        signUpView!.logo!.contentMode = .scaleAspectFit
        
        let dismissButtonFrame = signUpView!.dismissButton!.frame
        signUpView?.dismissButton!.frame = CGRect(x: 0, y: signUpView!.signUpButton!.frame.origin.y + signUpView!.signUpButton!.frame.height + 16.0,  width: signUpView!.frame.width, height: dismissButtonFrame.height)
    }
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
    
}

jschwartzmtn avatar May 28 '19 16:05 jschwartzmtn

This issue has been automatically marked as stale because it has not had recent activity. If you believe it should stay open, please let us know! As always, we encourage contributions, check out the Contributing Guide

stale[bot] avatar Jul 12 '19 16:07 stale[bot]

Can you assign it to me? I want to help the project

neil-degoo avatar Oct 06 '19 17:10 neil-degoo

Sure 🙂

TomWFox avatar Oct 06 '19 21:10 TomWFox

Thanks @TomWFox its my personal account, so I will fork and PR from this account. I will have a look today night/morning after my job

gneil90 avatar Oct 08 '19 17:10 gneil90