我有一个UITableView不是在故事板中创建的,而是由代码创建的。这张桌子可以通过选择一些其他的冠军刷新,但是当我这样做时,有另一张桌子与旧数据...我设置为零时间我刷新...重新启动UITableView问题
有人有一个想法?
为了填补我使用此代码表
listVideo = [listGroupes objectAtIndex:indexPath.row];
montageListView= [[UITableView alloc] initWithFrame:listFrame style:UITableViewStylePlain];
montageListView.delegate = self;
montageListView.dataSource = self;
montageListView.layer.cornerRadius = 10;
[listMontagesView addSubview:montageListView];
所以与其他的选择一个新的观点,但如果我回去与此代码:
montagesListView removeFromSuperview];
montagesListView = nil;
,我和填充它相同的代码
listVideo = [listGroupes objectAtIndex:indexPath.row];
montageListView= [[UITableView alloc] initWithFrame:listFrame style:UITableViewStylePlain];
montageListView.delegate = self;
montageListView.dataSource = self;
montageListView.layer.cornerRadius = 10;
[listMontagesView addSubview:montageListView];
,并有良好的表,但是有另一个与旧的数据... 我真的没有找到代码中的问题:/
这里是行单元格的代码,但我不认为这是问题,
static NSString *MyIdentifier = @"MyIdentifier";
NSString *text;
// Try to retrieve from the table view a now-unused cell with the given identifier.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
// If no cell is available, create a new one using the given identifier.
if (cell == nil) {
// Use the default cell style.
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:MyIdentifier];
}
if (tableView == groupListView) {
text = [listGroupesNames objectAtIndex:indexPath.row];
}else {
text = [[listVideo objectAtIndex:indexPath.row]description];
if ([[listVideo objectAtIndex:indexPath.row]note] == 1) {
cell.imageView.image = [UIImage imageNamed:@"good.png"];
}
if ([[listVideo objectAtIndex:indexPath.row]note] == 2) {
cell.imageView.image = [UIImage imageNamed:@"neutre.png"];
}
if ([[listVideo objectAtIndex:indexPath.row]note] == 3) {
cell.imageView.image = [UIImage imageNamed:@"bad.png"];
}
}
if ([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
cell.textLabel.font=[UIFont systemFontOfSize:18.0];
text = [NSString stringWithFormat:@" %@",text];
}else{
cell.textLabel.font=[UIFont systemFontOfSize:12.0];
}
if (tableView == groupListView) {
cell.imageView.image = [UIImage imageNamed:@"group.png"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
if(tableView == montageListView){
cell.imageView.image = [UIImage imageNamed:@"videos.png"];
}
cell.textLabel.text = text;
return cell;
是的,我这样做,所以我从超级查看中删除它,然后我重新启动它,所以有新的表正确填写,但它后面有旧的...它没有得到触摸事件,但它在那里.. –
Imma上传代码 –