Skip to content

PFSignUpViewController Additional Field #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jschwartzmtn opened this issue May 2, 2019 · 7 comments · Fixed by #1783
Closed

PFSignUpViewController Additional Field #1406

jschwartzmtn opened this issue May 2, 2019 · 7 comments · Fixed by #1783
Assignees
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@jschwartzmtn
Copy link

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).

@ShawnBaek
Copy link
Contributor

Thank you

@TomWFox
Copy link
Contributor

TomWFox commented May 25, 2019

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

@jschwartzmtn
Copy link
Author

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
    }
    
}

@stale
Copy link

stale bot commented Jul 12, 2019

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 stale bot added the Won't Fix label Jul 12, 2019
@TomWFox TomWFox added type:bug Impaired feature or lacking behavior that is likely assumed Good First Task and removed Won't Fix labels Jul 12, 2019
@neil-degoo
Copy link

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

@TomWFox
Copy link
Contributor

TomWFox commented Oct 6, 2019

Sure 🙂

@gneil90
Copy link

gneil90 commented Oct 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants