0

I have a table and so far, I can populate it by adding values to an array in the code. But I want to use a textfield values and enter it there, the only problem is, if I do that I can only have one value, I want to pass a textfield value without overwriting the current cell. Here is what I have:

-(void)viewDidLoad { [super viewDidLoad]; //[self fetchRecords]; titlestring = [[NSUserDefaults standardUserDefaults] objectForKey:@"titletext"]; detailsstring = [[NSUserDefaults standardUserDefaults] objectForKey:@"details"]; tabledata = [[NSArray alloc] initWithObjects:@"titlestring", nil]; tablesubtitles = [[NSArray alloc] initWithObjects:detailsstring, nil]; } 

Is there a way to use MyArray[i] = marry initWithObjectcs...

Thanks.

4
  • Is this piece of code relevant ? Commented Feb 23, 2012 at 13:10
  • Not sure, I just want to know how to add a variable to that array in the second slot Commented Feb 23, 2012 at 13:18
  • assuming you've correctly implemented table view datasource methods, this should be as simple as [myArray addObject:myString]... Commented Feb 23, 2012 at 13:33
  • Could you explain better your goal? Thank you. Commented Feb 23, 2012 at 13:45

1 Answer 1

1

I don't understand what you is your problem. But if you want to add objects to an existing array, you should use a NSMutableArray not a NSArray.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.