如何遍历TableView中所有Cell的值
1个回答
推荐于2016-10-18
展开全部
-(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);
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询