0

I have an initial ViewController that is a TableView with lots of data. I have a title bar button item that links to another TableView with a summary of the data in the first ViewController. I currently have it so that when you click on a cell, it redirects the user back to the first ViewController and scrolls them to the proper cells. However, it adds the view to the stack and doesn't actually move them back properly. I think I would be able to do this through Unwind segues, but I can't seem to get them to work through cell clicks. Is there a better way that I can achieve this?

When I switch to the other view, I also need to set two variables in the initial controller to tell it what index to scroll to.

Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71
Aaron
  • 306
  • 1
  • 4
  • 11

1 Answers1

0

1.UNWind Segue : suppose that we need to programmatically trigger the backward navigation, based on an interaction with something other than the default “back” button on the navigation bar. How would you do it? Yep – you’ve got it: by using an unwind segue.

2.Other way is usual : PopViewController Method

As per your question , you can go with option 2 which is more easy .

As far as Sending data from SecondViewController to FirstViewController you can use delegate pattern to send data back. Here is few useful post : https://stackoverflow.com/a/25523091/3400991

Feel free to comment. Thanks

Community
  • 1
  • 1
Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71