ios - How do I save/load data in my application using NSCoding? -


yes, i've looked through numerous questions similar asked already; however, still did not quite understand going on or @ least couldn't figure out how in application.

so "practice" app has main view controller displays 2 text labels. these text labels populated nsobject class holds large array. user inputs number in array want go to, , string @ index in array becomes text in 1 label, while user-input number becomes text in other label. user can "favorite" string array pressing button. when happens string , it's index number added 2 separate mutable arrays reside in main view controller. then, when user wants see of "favorites", can swipe (modally) bring uitableview has of user's "favorite strings". achieved passing data (2 mutable arrays) main view controller uitableviewcontroller using navigation controller/segue. @ point, there 2 mutable arrays in uitableviewcontroller contain strings , index numbers main view controller. data passed main view controller using delegate/protocol set text (in row user tapped on uitableview) in label on main view controller.

i have no problem building app; works perfectly. have no idea how save data when user quits application , reopens can still see table view of strings they've favorited. also, i'm assuming in case, should use nscoding; if, however, need use core data or else, let me know. if can me out, i'd really appreciate it. detailed explanations please, , sample code if possible.

you can use 1 of following way acheive it

  1. core data - if handling large number of records go o it.but per understanding more necessary solution.
  2. nsuserdefauls - if favourites restricted hundreds of records best option
  3. nskeyarchiver/nscoding - if want save objects local file system can use option please refer here more info on

happy coding


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -