我这样声明我的表:
CGRect cgRct = CGRectMake(5, 5, 310, 363);
videoTable = [[UITableView alloc] initWithFrame:cgRct style:UITableViewStylePlain];
videoTable.backgroundColor = [UIColor clearColor];
videoTable.separatorColor = [UIColor whiteColor];
videoTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
videoTable.dataSource = self;
videoTable.delegate = self;
videoTable.alwaysBounceVertical = NO;
videoTable.bounces = NO;
videoTable.allowsSelection = YES;
//self.videoTable.layer.zPosition = -1;
//table.dragging = NO;
[self.view addSubview:videoTable];
当我们离开视图时,我删除了我的桌子
-(void) viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
NSLog(@"*viewDidDisappear");
if (videoTable)
{
NSLog(@"removing table");
[videoTable removeFromSuperview];
videoTable.delegate = nil;
[videoTable release];
// self.videoTable = nil;
}
}
当视图再次加载时,没有表格的迹象,但是..它仍然存在,因为
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self populateFileList];
if (videoTable)
{
NSLog(@"table still here");
}
else
{
NSLog(@"No table");
}
}
谁能解释我错过了什么?我希望表完全消失,所以我可以分配一个新表。
非常感谢,-代码