gpt4 book ai didi

iphone - IOS UItableview reloadRowsAtIndexPaths 刷新问题

转载 作者:可可西里 更新时间:2023-11-01 05:14:20 26 4
gpt4 key购买 nike

我想更新到 tableview 自定义单元格。我想在搜索时刷新表格单元格。我使用 reloadRowsAtIndexPaths 方法。这种方法有效,但没有更新单元格。你能帮帮我吗

当我搜索时下面的方法运行

-(void)doSearchHotelName:(id)sender{

NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:1 inSection:0];

[self.tableV beginUpdates];
[self.tableV reloadRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationFade];
[self.tableV endUpdates];

}

下面方法表方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"Hotel_FilterSearchCell";

Hotel_FilterSearchCell_iPad *cell = (Hotel_FilterSearchCell_iPad *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];




if (cell == nil)
{
NSArray *nib ;

nib = [[NSBundle mainBundle] loadNibNamed:@"Hotel_FilterSearchCell_iPad" owner:self options:nil];

cell = [nib objectAtIndex:0];
}

else if ([indexPath row]==1) {


if([SharedAppDelegate.filter_selected_hotels_list count]==[SharedAppDelegate.filter_hotels_list count])

[cell.cellExtraInfo setText:@"All(H)"];

else if ([SharedAppDelegate.filter_selected_hotels_list count]!=[SharedAppDelegate.filter_hotels_list count])

[cell.cellExtraInfo setText:[NSString stringWithFormat:@"%i %@",[SharedAppDelegate.filter_selected_hotels_list count],@"Selected(H)"]];

}

cell.selectionStyle = UITableViewCellSelectionStyleNone;

return cell;
}

最佳答案

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];

关于iphone - IOS UItableview reloadRowsAtIndexPaths 刷新问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12526468/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com