ios - Data is persistent in one table view, but not when switching between other view controllers -
i'm looking implement contacts list app. have add contact working , actively uses nscoding writing disk contacts. update between list of contacts , new contact view, doesn't when switch view.
do need prepareforsegue
when coming non-contact views in way prepares data? or need create set<contacts>
in first view , pass references through when going between views. of updates data when unwindsegue
add contact view controller.
i need more context (code) sure solve case.
but had similar issues in past 1 simple reason:
i put refresh code in viewdidload()
. called when viewcontroller loaded (first time appears), not every time switch (doesn't reload it).
you should put code in viewdidappear()
, or viewwillappear()
if want executed each time "switch" view.
here code:
viewdidappear(){ code code code refreshes view contacts }
here should be:
viewdidload() { code code } viewdidappear() { code refreshes view contacts }
code want executed each time view appears on screen should put in "viewdidappear()
".
Comments
Post a Comment