-1

I have a list of teams which individually contains,the list of team members, So in detail,my first tableview controller,contains the list of teams,for ex..team A,team B,team C and so on,and when i click on particular team,it drills to another tableview controller,and shows one more list of team members,I want to save this data to file ,so that even if the user kills the app,he should get the list of team names and team members,so how can i do it

Thanks and dRegards Ranjit

Ranjit
  • 4,576
  • 11
  • 62
  • 121

1 Answers1

0

You can use an NSArray of NSArrays to store a list of teams with lists of members. To store that persistently, you can use NSUserDefaults:

[NSUserDefaults standardUserDefaults] setObject:yourArray forKey:@"TeamList"];
bdunagan
  • 1,202
  • 12
  • 15
  • Thanks for your reply how about using a plist..? – Ranjit Oct 19 '11 at 10:19
  • and hey its not just a static array a user will add his team with the team members..so when the user adds the team it should be saved with the saved members and next time if he adds another team the previous team should also be present – Ranjit Oct 19 '11 at 10:26
  • NSUserDefaults is a plist internally, but Apple gives it a nice API for getting and setting. For mutable objects, just convert the array of arrays to NSMutableArrays, and you're good. – bdunagan Oct 22 '11 at 14:07
  • hey thanks ,can u please provide me sample code..and also I want to now ,how can we prevent overwriting of the team array list? – Ranjit Oct 22 '11 at 18:10