I'm learning iOS at school but can't seem to get my head around the coding.. Which is what I need to do for my final project. Thus I would like to seek your kind help and guidance here...I kind of grasped the concept of how I would like my app to go, and how to create the GUI(probably) but would need advice on the coding for it and the data persistency. Say my main viewcontroller is a tableview which is empty at first, but if I click on the add button, it will direct me to a form where you can fill in a person's name and say maybe their score. Then when you save and go back to the main view, the person's name is listed out. You can add more persons or edit a person by tapping on the name(it will return you back to the form where you can edit the score etc).
Thanks in advance! (I did revise my notes many times but I still couldn't get it >_<)
Check out this gitHub commit or download zip for the project in full. I hope the comments helped in this project.
Okay so how I normally complete a situation like this is what follows:
+returnContentsOfDatabase
and + returnFormattedPersonForArray:
would save duplication if saved else where.[arrayPerson objectAtIndex: 0]; //returning the name
but doesn't this look better [arrayPerson objectPerson_name]; //returning the name, without having to remember the index number
. This also saved having to find and replace values when you add something new like age, isMale, and other info to save per person. You would only have to change code in one place! Check out this q&a on how to follow up on this+returnFormattedPersonForArray:
declared in the Library.h file. And where you'd use this index is when you're saving a record that already exists. Say in the RecordEditorViewController, in the method pressRightNav:, when option == CTRecordModify
you have to remember to remove that index saved in the array. You don't need that number to be saved in the data file. so you remove it by calling -removeLastObject
. Because the index is saved in as the last object, then you replace it.And I hope this helps on what you're asking for, @Silv