hiw*_*dls 4 iphone uitableview ios
我想更新到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];
}
Run Code Online (Sandbox Code Playgroud)
方法表方法下面
- (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;
}
Run Code Online (Sandbox Code Playgroud)
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15588 次 |
| 最近记录: |