在 ViewDidLoad 中使用 objectAtIndex:indexPath.row
Use objectAtIndex:indexPath.row in ViewDidLoad
我使用数组 (self.tableData) 和 objectAtIndex:indexPath.row
来检索 NSString。
这是我的代码:
Person *person = [self.tableData objectAtIndex:indexPath.row];
cell.textLabel.text = person.fullName;
我想用person.fullName;在 ViewDidLoad
但我不知道该怎么做。对不起,如果这是一个愚蠢的问题...
在viewDidLoad
中你可以静态访问:
for (int i = 1; i <= [self.tableData count]; i++)
Person *person = self.tableData[i];
NSLog("name: %@",person.fullName);
}
在cellForRowAtIndexPath
中可以动态访问:
Person *person = self.tableData[indexPath.row];
cell.textLabel.text = person.fullName;
我使用数组 (self.tableData) 和 objectAtIndex:indexPath.row
来检索 NSString。
这是我的代码:
Person *person = [self.tableData objectAtIndex:indexPath.row];
cell.textLabel.text = person.fullName;
我想用person.fullName;在 ViewDidLoad
但我不知道该怎么做。对不起,如果这是一个愚蠢的问题...
在viewDidLoad
中你可以静态访问:
for (int i = 1; i <= [self.tableData count]; i++)
Person *person = self.tableData[i];
NSLog("name: %@",person.fullName);
}
在cellForRowAtIndexPath
中可以动态访问:
Person *person = self.tableData[indexPath.row];
cell.textLabel.text = person.fullName;