Present PFSignUpViewController manually: Parse Framework iOS

352 Views Asked by At

I'm using PFLoginViewController and instead of presenting it modally, I am presenting it as a subview so I can have a nice translucent background:

enter image description here

The only issue is that when I select Sign Up, it presents my Sign Up view controller modally which according to my console log, isn't the smartest idea: Presenting view controllers on detached view controllers is discouraged

So what I would like to do is use a separate method for displaying my sign up view controller. I tried this:

[loginView.logInView.signUpButton  addTarget:self action:@selector(presentSignUpView:) forControlEvents:UIControlEventTouchUpInside];

But the original Parse method was being called with my custom method being called in addition. I looked at the docs and there is no delegate method for adding your own custom method so how should I go about doing this?

1

There are 1 best solutions below

3
Jogendra.Com On BEST ANSWER

Have you try to change here "presentSignUpView:"

[loginView.logInView.signUpButton  addTarget:self action:@selector(presentSignUpView:) forControlEvents:UIControlEventTouchUpInside];

For custom view First make a function that can call you for custom view open like this

-(void)customSignUpViewOpen{
  //Implement your custom view controller code here ..   
}

Updated remove target before add ..

[loginView.logInView.signUpButton  removeTarget:self action:@selector(presentSignUpView:)  forControlEvents:UIControlEventTouchUpInside];

and Call this in your button clicked like this

[loginView.logInView.signUpButton  addTarget:self action:@selector(customSignUpViewOpen) forControlEvents:UIControlEventTouchUpInside];