2010-06-13 53 views
0

我试图在表格视图中获取单元格的值,但它不会让我。如果有人能够帮助那会很好。我无法获得可可触摸中的表格视图单元格的值

int numberOfChecks = -1; 
numberOfChecks = numberOfChecks +1; 

    if ([objectsForTable count]-1 >= numberOfChecks) { 


     UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:numberOfChecks]; 

     NSString *cellTitle = cell.textLabel.text; 

    } 

回答

0

的cellForRowAtIndexPath:方法不受UITableView的提供,由UITableViewDataSource delegate提供该方法。您必须将表中的dataSource属性设置为指向您的委托,因为您必须提供数据。假设你这样做了,可以使用表的dataSource属性来调用你自己的数据源:

NSIndexPath *path = [NSIndexPath indexPathWithIndex: ... ]; 
UITableViewCell *cell = [self.tableView.dataSource tableView:self.tableView 
             cellForRowAtIndexPath:path]; 
相关问题