Pregunta

This seems like it should be so simple to create, but have had my gears turning on how exactly to set it up. Basically I want to create a way for users to be able to save and update their exercise data as they use the app. They will also be able to go back and review any day for their exercise results on that day. I am currently considering using property lists for doing this, but is there a better way?

Example:

04-28-12
-- Exercise: Bench Press Set 1: 115 lbs x 12 reps Set 2: 125 x 10 reps Set 3: 130lbs x 8 reps

-- Exercise Squats Set 1: 215 x 10 reps Set 2...etc;

I really appreciate any input that you guys have on this!
Thanks.

¿Fue útil?

Solución

One way to do this is to use an NSArray which contains other arrays and an NSDictionary which can all be stored in a property list.

Then your structure would be like:

People (NSArray)
|
 --> Exercises (NSArray)
     |
      --> Sets (NSArray)
          |
           --> 0 (NSDictionary)
               |
                --> Weight (key): 115 (value)
               |
                --> Repetitions (key): 12 (value)
               |
                --> Type (key): 1 (value integer mapped to exercise type like Squats)

This can be pretty cumbersome though when you get a lot of data in this one property list, so you might want to consider using Core Data instead (http://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top