【发布时间】:2012-02-16 06:10:14
【问题描述】:
我采用了一个自定义单元格,我没有在那边重用标识符。我在使用自定义单元格的表格视图中使用标识符。但是当我运行我的应用程序并在文本字段中输入数据时,当我滚动视图时,我的数据会被删除。我的单元格没有重用这些数据。任何人都可以帮助我解决这个问题。谢谢!
自定义单元格代码
-(UITableViewCell *)returnCellForEach:(UITableView *)tableView
{
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
myLabel = (UILabel *)[customCell.contentView viewWithTag:10];
return customCell;
}
表格视图'cellForRowAtIndexPath'代码
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"Hello"] autorelease];
}
这件事有什么错误。谢谢!
【问题讨论】: