-2

I use an array (self.tableData) with objectAtIndex:indexPath.row for retrieving NSString.

Here is my code :

Person *person = [self.tableData objectAtIndex:indexPath.row];
cell.textLabel.text = person.fullName;

I would like to use person.fullName; in ViewDidLoad but I don't know how to make this. Sorry if it's a stupid question...

xcode_Dev
  • 237
  • 4
  • 16

1 Answers1

1

In viewDidLoad you can access statically:

for (int i = 1; i <= [self.tableData count]; i++)
   Person *person = self.tableData[i];
   NSLog("name: %@",person.fullName);
}

In cellForRowAtIndexPath you can access dynamically:

Person *person = self.tableData[indexPath.row];
cell.textLabel.text = person.fullName;
Klevison
  • 3,342
  • 2
  • 19
  • 32