I want to change segue identifier based on button selection. I have two button if button one is touched I have 7 view with segue. If button two touched I want to change my segue identifier value.
Asked
Active
Viewed 303 times
-1
-
You should share your code with us so that we can see what you have tried. – iPeter Mar 16 '17 at 10:57
-
http://stackoverflow.com/a/41887007/5461400 try this – Harshal Valanda Mar 16 '17 at 10:57
-
I want to change identifier1 to identifier 4 or identifier 6 something. How can I do this programmaticallyy – Sabarinathan Jayakodi Mar 16 '17 at 11:00
-
1You can't change the segue that is performed by an action assigned in IB. You can use a touchUpInside handler and call `performSegueWithIdentifier` with the required segue identifier. – Paulw11 Mar 16 '17 at 11:05
-
I want to set segue identifier programmatically based on view controller name. Plz help me. – Sabarinathan Jayakodi Mar 16 '17 at 11:05
-
check My answer. create a segue and call perform segue in button action :- http://stackoverflow.com/a/41887007/5461400 – Harshal Valanda Mar 16 '17 at 11:08
-
I want to change identifier programmatically when some button pressed. Ex-segueToNext1 identifier to segueToNext2. Any help please. – Sabarinathan Jayakodi Mar 16 '17 at 11:17
-
@Sabarinathan - you already have the right answer to this question - please stop repeating your question in the comments – Russell Mar 16 '17 at 11:46
1 Answers
2
Don't link your segues to the button. Link your segues from view controller to view controller and give them unique identifiers.
Then connect your buttons to IBActions and write your button IBAction code to call performSegueWithIdentifier:sender:
to invoke the desired segue.

Duncan C
- 128,072
- 22
- 173
- 272
-
I am using MXPagerViewController. I have 10 view controller, for button1 I am showing all view controllers. I want to show any of two or three view controller for button2 based on request. – Sabarinathan Jayakodi Mar 16 '17 at 11:24
-