ios - Unwind Segue to two different UIViewControllers -


i have app uiviewcontroller using add item uitableview. user fills out few fields, , data displays in cells. i'm doing unwind , using function on calling view, retrieve data. create unwind, click dragged controller exit, , selected function.

now, want use same uiviewcontroller different uiviewcontroller, permit users edit data added. when click accept button, unwinding uitableviewcontroller, instead of view called editing.

the code accept button is:

@ibaction func acceptbuttonclick(sender: uibarbuttonitem) {      performseguewithidentifier("returnfromadditem", sender: title) } 

what want this:

@ibaction func acceptbuttonclick(sender: uibarbuttonitem) {     if !editingfields {         performseguewithidentifier("returnfromadditem", sender: title)     }     else {         performseguewithidentifier("returnfromedititem", sender: title)     } } 

it doesn't appear can though. segue id returnfromadditem. don't see way add 2 unwind segues. idea how might approach this? want same functionality have on add. want unwind function on caller.

i should elaborate bit. able add second unwind control click drag exit, when call in performseguewithidentifier, nothing. there no error, not leave view controller , go caller.

editing elaborate further.

the base controller called baseviewcontroller. uitableview. in navigation bar "+" button calls uiviewcontroller named addviewcontroller. when "+ button clicked, there's segue takes user addviewcontroller. user fills out few fields , clicks accept button. code accept button listed above. calls unwind segue, , go baseviewcontroller. when user taps on item in baseviewcontroller, takes user uiviewcontroller named informationcontroller. there, i'd give user chance edit data clicking on settings button on navigation bar of informationcontroller. segue addviewcontroller uiviewcontroller, use edit existing fields. want unwind , go informationcontroller when addviewcontroller called informationcontroller, , baseviewcontroller when addviewcontroller called baseviewcontroller. problem i'm having though added unwind segue addviewcontroller informationcontroller, nothing happens when click accept button.

final edit: think have figured out. in informationcontroller, using viewwilldisappear call unwind segue basecontroller. when click settings call addviewcontroller informationcontroller, viewwilldisappear firing, , unwinding baseviewcontroller. need figure out whether should continue use viewwilldisappear , find way tell it not disappearing because i'm done it, or if should executing unwind somewhere else.


Comments