I am new to objective-C and I'm having a lot of trouble trying to add new rows to a table. The way it is suppose to work is, when the app loads an alert pops up asking the user if they would like to, start a new configuration, load a saved configuration, or resume the last configuration. Now if they select start a new configuration, they will be asked to enter in the new name and when they tap done the app will save the new configuration in a table. Right now I can only get the app to store just one configuration in the table, but if the user tries to make another new configuration then the app crashes. Here is what my code looks like:
- (IBAction) testToAddToList
{
nameOfConfig = @"Test Name"; //this just bypasses the user from having to enter a name
NSMutableArray *array = [[NSMutableArray alloc] init];
[array insertObject:nameOfConfig atIndex:configListDataIndex];
self.configListData = array;
[array release];
configListDataIndex ++;
}
I have been reading a lot about this stuff but i must be having the biggest brain fart of my life right now because this does not seem like it should be too hard. Also I feel that the main problem is that "array" only has one index and when the user tries to add another that is what makes the app crash.
Could someone please help me out and tell me what i am doing wrong and how i can do it right? Please!...Or maybe just point me in the right direction? Thank you for your time!!