C.Johns
C.Johns

Reputation: 10245

how to pass variables between a complex navigational stack

I have several uitableviews that the user can use to set different types of search parameters in my application, I will allow the user to select a cell that will then push a new view onto the stack in which the user can choose what to search and then return back to the original view with the value passed into the originally selected cell..

Where this gets complicated is that each of the original search views will be able to push the same view for search results onto the stack..

here is a graphical example of what I mean as it is hard to explain.

enter image description here

In this example only one viewcontroller can show at a time when a cell in the current view controller is selected the subview is loaded with the list of options, both view controllers use the same subviewcontroller.

My question is to do with returning values that you select in the subviewcontroller back to the correct viewcontroller...

I am trying to figure out how to return the selected value in the subviewcontroller to the correct cell in the correct viewcontroller.. I am hoping to get some suggestions on the correct way to handle this type of view structure as its not really covered in many books that I have available to me, plus I hope to draw on your guys knowledge and experience with similar projects.

Upvotes: 0

Views: 70

Answers (1)

One common way is to define a protocol in the sub view controller for callbacks, and have each of the main view controllers implement that... when they create or call up the sub view controller, they tell it that they are the selection delegate to be called when a change is made. Then they can also choose to dismiss the sub view controller.

Upvotes: 1

Related Questions