Search code examples
iosobjective-cswiftparse-platformpfloginviewcontroller

Can't Modify the PFLogInViewController logInButton title


i'd been using Parse.com services in my new iOS app development, so far it works like a charm, however i'd been trying to modify the login button text from the PFLogInViewController using code in both swift and objective-C but the results are the same (NONE!)

ObjC

 [logInViewController.logInView.logInButton setTitle:@"Test!" forState:UIControlStateNormal];
 logInViewController.logInView.logInButton.titleLabel.text = @"Another Test";

Swift

 self.logInView.logInButton.setBackgroundImage(UIImage(named: "loginBtn"), forState: UIControlState.Normal )

Solution

  • I finally figure out how to solve this, you must apply the changes in the event

    Swift

    override func viewDidLayoutSubviews()
    {
        println("didLaoutSubView")
        self.logInView.logInButton.setTitle("Test", forState: UIControlState.Normal)
        self.logInView.logInButton.setTitle("Test", forState: UIControlState.Highlighted)
    }
    

    ObjC

    -(void)viewDidLayoutSubviews
    {
        [self.logInView.logInButton setTitle:@"Test!" forState:UIControlStateNormal];
        self.logInView.logInButton.titleLabel.text = @"Another Test";
    }