Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Table Views in iOS Part 8: Static Cells

Learn how to create static cells for your table views. Because static cells don't change they are a great way to create edit view controllers for your app.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3300-table-views-in-ios/lessons/9

Hi Brian. Thanks for the tutorial series - very fun and informative.
I am struggling with one aspect of it though and was hoping you could help me out with it please…
I can see how data is passed to the Edit controller in the prepareForSegue method, but I’m struggling to see how the edited data is then passed back to the first view controller. If its in the viewWillDisappear method of the Edit view controller, I can’t see how that is able to access the bug variable in the first view controller…
Any help would be much appreciated!
Thank you!

You have to remember that the object is a class and passed by reference. When the edit viewcontroller is created, it is assigned to an instance variable. A reference is already stored in the current viewcontroller.

Any changes you make in the edit view controller to that object will be reflected in the viewcontroller since it’s the same object. Thus, you don’t need to pass the object back to the viewcontroller.

I hope that helps!

Thanks for the quick response Brian.
That does help, thank you. That logic makes perfect sense - I had been struggling to achieve the same results in some practice projects I’d been running in parallel to the tutorial series, but I think the penny has now dropped.
Thanks for your help, and thanks once again for a great series.

I had the same question as pabs. Thank you for clearing that up Brian!