每次滚动UITableview时,会有48个字节的内存泄漏。
负责的库:libsystem_c.dylib
负责的帧:strdup。
这仅在iOS 5.1上观察到,而在早期版本上没有发现。
是否还有其他人遇到了相同的问题?这是iOS 5.1中的一个错误吗?
代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath(NSIndexPath *)indexPath
{
NSString *cellIdentifier = [[NSString alloc] initWithString:@"fontSelectionCell"];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
[cellIdentifier release];
if (cell == nil)
{
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
}
cell.textLabel.text = [fontNameList objectAtIndex:[indexPath row]];
cell.selectionStyle =UITableViewCellSelectionStyleGray;
cell.textLabel.font = [UIFont systemFontOfSize:17.0];
if ([fontName isEqualToString:cell.textLabel.text])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
cell.textLabel.textColor = [UIColor blueColor];
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.textColor = [UIColor blackColor];
}
return cell;
}