NsuserDefault add NsmutableArray dynamically Problem
I am using nsuserdefault to save preference settings. I save nsmutable array in nsuser default dynamically .when the user clicks the button it works fine but when user click buttons in table table view object of nsmutableArray save in nsuser default and we excess it through out the app but when i came back to the view and again click the button it adds nsmutableArray object in nsuerDefault but the old value of nsuerDefau开发者_JAVA百科lt is overriden. I want that old value not to be overidden and new value is added in nsuser default
Then you have to load previously saved array from user defaults. Then update it with new values and save it there again.
NSMutableArray* saved_array = [NSMutableArray arrayWithArray: [[NSUserDefaults standardUserDefaults] arrayForKey: @"array_key"]];
//update saved array
[[NSUserDefaults standardUserDefaults] setValue: saved_array forKey: @"array_key"];
精彩评论