I have an NSMutableArray that is populated from a plist file, and I have some other data that is dynamically generated in my application (distance data) for each object (dictionary) in my array. I am hoping to get some assistance in the best way to do this.
Basically I need to:
Pull data from Plist file into an array(done)
Use location data from plist file to calculate distance (done)
Combine the plist data with this new distance data into an array that I can then use for my display
My coding experience is in VB6 so I am little lost with the language here at times....
I have done a little searching but have not found what I need yet so would greatly appreciate some assistance or links through to some similar examples.
I am pretty inexperienced as well so I may be missing the crux of the problem but can you not just use the "addObjectsFromArray:" method to add the generated values to the plist data Array:
Thanks for your help - the loop function in Objective-C was what I was really looking for. XCode Edit > Insert Text Macro set me going. This allowed me to manipulate the data for each object and then do a replaceobjectatindex.
Thanks for your help - the loop function in Objective-C was what I was really looking for. XCode Edit > Insert Text Macro set me going. This allowed me to manipulate the data for each object and then do a replaceobjectatindex.
Cool, glad you got what you were looking for. Any chance that you could post the piece of code that you used so that I may learn something, I am not sure I fully understand. As I said, I am quite new to this as well.
I have a basic if statement to see if the current location has been found, if it has it uses the same code as below with a bit more padding to calculate a distance, if current location has not been found the arrary of locations is updated with a new key called distance with a value of Location Not Found.
Basically it reads the object from the current array index into a dictionary (not required here as we allready know the location has not been found), uses the location information about the object that it pulled from the array (once again not shown here), creates a new string - distancestring, adds a new key to the array (distance) and adds the distancestring as the value to the new key.