如何遍历TableView中所有Cell的值
1个回答
2016-02-09
展开全部
-(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);
}
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);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询