In the FirstViewController of my survey app I have NSMutableArray that contains data (strings). I’ve also created date varibale. Here’s code
NSDateFormatter *dateformater=[[NSDateFormatter alloc] init];
[dateformater setDateFormat:@"EEEE,dd MMMM yyyy HH:mm a"];
NSDate *today=[NSDate date];
NSString *currentDate=[dateformater stringFromDate:today];
Now I want with the help of NSUserDefaults save data from the array and also save date variable when the survey has been taken and display it in the SecondViewController’s tableview (first user can see date of the survey and then by tapping the date – data from array).
I know how NSUSerDefaults work but I don’t know how to put array by date variable to be shown in the SecondViewController. Can anyone help me on that?
In
AppDelegate.hfile just declare variable…after…
In
AppDelegate.mFille inapplicationDidFinishLonching:Methodafter that when you want to insert,update or delete Data from this UserDefaults Use Bellow Code…
for Delete record from array
and this is for add record in array..
after in final save this modification in array just archive like bellow..