ios - How do I save/load back the data after closing the app in multitasking for iPhone? -


i have created app requires adding , showing information added in table view. however, may close apps in multitasking.

i know how being done whereby after closing app, can still continue last close application (or after reboot).

current implementation:

example (added information in , before closing app)

  • list no. 1
  • list no. 2

example: (after closing app , relaunching it: nothing displayed)

  • -nil-

wanting implement:

example (added information in , before closing app):

  • list no. 1
  • list no. 2
  • list no. 3

example: (after closing app , relaunching it: displays shown before closing app)

  • list no. 1
  • list no. 2
  • list no. 3

i have been searching around answers no avail. hope can help.

thanks!

code retrieving , displaying data in tableview:

uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"class" forindexpath:indexpath];  msddatacontroller *dc = [msddatacontroller sharedinstance];  nsarray  *dataarray = [dc getallelement];  long row = [indexpath row];  nsstring *modulename = [dataarray[row]modulename]; [[cell textlabel]settext: modulename];  nsstring *modulevenue = [dataarray[row]modulevenue]; [[cell detailtextlabel]settext:modulevenue];  return cell; 

based on comment sounds problem persisting data have added table. once app closed down data gone need store values how , reload them when app next opened. how persist data depends on amount of information want store. if simple relatively small amounts can use plist, otherwise want @ coredata.

an example of using plist can seen here save array plist. app more suited using more complicated more powerful coredata, can see loads of tutorials online example http://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started.

basically before app closed need call msdatacontroller , ask write information device , when viewcontroller loaded again call msdatacontroller , load information memory , pass viewcontroller.

at moment adding values array stored in memory. once app closed , reopened , values in memory lost.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -