Ios TableView滚动正在重新格式化字体
我有一个扩展/收缩表视图。我的父单元格的样式与子单元格的样式不同(父单元格的字体较大,子单元格的字体较小)。当我展开父单元格以显示子单元格,然后向下滚动以查看更多子单元格时,一旦我向上滚动以收缩父单元格,父单元格现在已采用子单元格的字体大小。我想这和释放可回收电池有关。下面是我用来配置单元格的方法:Ios TableView滚动正在重新格式化字体,ios,tableview,Ios,Tableview,我有一个扩展/收缩表视图。我的父单元格的样式与子单元格的样式不同(父单元格的字体较大,子单元格的字体较小)。当我展开父单元格以显示子单元格,然后向下滚动以查看更多子单元格时,一旦我向上滚动以收缩父单元格,父单元格现在已采用子单元格的字体大小。我想这和释放可回收电池有关。下面是我用来配置单元格的方法: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexP
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
}
// Configure the cell...
if ([self tableView:tableView canCollapseSection:indexPath.section])
{
if (!indexPath.row)
{
// first row
cell.textLabel.text = @"Expandable"; // only top row showing
}
else
{
// all other rows
cell.textLabel.text = @"Some Detail";
cell.textLabel.textColor=[UIColor blackColor];
cell.textLabel.font=[UIFont fontWithName:@"Arial Rounded MT Bold" size:10.0];
cell.accessoryView = nil;
}
}
else
{
cell.accessoryView = nil;
cell.textLabel.text = @"Normal Cell";
}
return cell;
}也为父单元格设置字体:
else
{
cell.accessoryView = nil;
cell.textLabel.text = @"Normal Cell";
cell.textLabel.font=[UIFont fontWithName:@"Arial Rounded MT Bold" size:20.0];
}