I am trying to get the value of a cell in a table view but it won't let me. If someone could help that would be great.
int numberOfChecks = -1;
numberOfChecks = numberOfChecks +1;
if ([objectsForTable count]-1 >= numberOfChecks) {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:numberOfChecks];
NSString *cellTitle = cell.textLabel.text;
}开发者_如何学运维
cellForRowAtIndexPath: method is not provided by UITableView, that method is provided by the UITableViewDataSource delegate. You should have set the dataSource property in the table to point to your delegate for this since you have to provide the data. Assuming you did that, you could use the table's dataSource property to call your own data source:
NSIndexPath *path = [NSIndexPath indexPathWithIndex: ... ];
UITableViewCell *cell = [self.tableView.dataSource tableView:self.tableView
cellForRowAtIndexPath:path];
精彩评论