如何遍历TableView中所有Cell的值

2025-04-28 10:48:31
推荐回答(1个)
回答1:

-(IBAction) refreshPrice:(id)sender

tableView:(UITableView *) tableView

{

NSString *allSet;

allSet=@"&";

UITableViewCell *cell;

for (int i=[allSets count]; i>0; i--)
{
//allSet=[allSet stringByAppendingFormat:@"%d",i];

if (cell==nil) {

cell=[tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndex:i]];

}
//cell=[tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndex:i]];

allSet=[allSet stringByAppendingFormat:@"%@",cell.textLabel.text];

[cell release];

}

NSLog(allSet);

}