iphone - Problem with savin data! -
i have uitableview , checklist. want able save data when user leaves view. when view opened want there saved data. when saved data mean table view able add , delete cells want able save checkmarks. please provide me way or idea on how this?
i know can save data with:
nsuserdefaults * defaults = [nsuserdefaults standarduserdefaults];
and save data defaults, need know how on saving table view's cells add , or deleted! know how save checkmarks!
thank you, kurt
i suggest using either core data, or nscoding. nscoding allows encode object nsdata, , reload replica of object nsdata.
for instance, saving , loading array of strings through nscoding this:
nsarray * array = [nsarray arraywithobjects:@"this", @"is", @"a", @"test"]; nsdata * encoded = [nskeyedarchiver archiveddatawithrootobject:array]; // save encoded data file... // load encoded data file... nsarray * decodedarray = [nskeyedunarchiver unarchiveobjectwithdata:encoded];
of course, need implement nscoding stuff if plan on using classes more complicated nsdictionary, nsarray, nsstring, etc.
documentation nskeyedarchiver can found here. can find documentation nscoding protocol here.
Comments
Post a Comment