I have to push a new segue when a button is pressed. But i also have an action attached to it that needs to be triggered before the segue is pushed.
Can you tell me how to separate them from each other? Any help would be appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make the segue directly from one view controller to the other instead of connecting it to the button. Give it a meaningful name.
Then, in your button’s action method, perform whatever you need to do first, then perform the segue using your view controller’s
performSegueWithIdentifier:method, using the meaningful name you chose earlier.From your comments, it seems like you’re trying to set properties on the view controller that is about to appear from your segue. If this is the case, you should implement
prepareForSegue:, and usesegue.destinationViewControllerto get a pointer to the view controller that is about to appear.