Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i m pretty stuck on this one rite now let me explain the problem this way:

  • Motor View Controller (table 1)
  • Add New Motor (table 2)
  • show motor Detail (View 1)
  • edit Motor Detail (table 3) now what happens is i go to table 1 then click on add button then go to table 2 and add a new motor on table 1 when i click on row of table 1 i go to view 1 where my details are shown in the labels and wen i click the edit button on this view a edit screen pops up now when i edit here i wanna save these details back onto my view 1 how do i do it ?( im using storyboard and all views are connected through segue's ) (basically i want to do edit function so wen the the edit screen comes up i want to see the existing details in my text boxes n den i get to edit dem n den save them back)thank you
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
154 views
Welcome To Ask or Share your Answers For Others

1 Answer

I have two answers for you.

  1. You need a permanent store for your data. Check out Apple's Core Data. They have documentation and an example. Also see RayWenderLick's Tutorial on Core Data. The answer is you will use Core Data to create a persistent store creating an sql database. The database will have an entity for motors. Each entry for the database will contain the detail for one motor. Each view controller (table) will access the database.

    This solution provides you with a persistent store. If your power the phone off and on again you will still have your data.

  2. A quick solution is to setup a delegate protocol which would allow the edit view controller to write data back to one of the other view controllers. Read Understanding Fundamental Design Patterns.

    This solution may get you past your immediate problems but does not provide a persistent store.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...