tableView里面有其他的控件,有时会出现cell的文字在选中单元格重叠的情况,解决方法是把空间定义在 if(cell==nil)里,
if(cell==nil)
{
cell=[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:RootViewControllerCell] autorelease];
CGRect textValueRect=CGRectMake(90, 15, 150, 40);
UILabel *textValue=[[UILabel alloc]initWithFrame:textValueRect];
textValue.textColor=[UIColor whiteColor];
textValue.tag=NameValueTag;
textValue.backgroundColor=[UIColor clearColor];
textValue.font=[UIFont boldSystemFontOfSize:18];
[cell.contentView addSubview:textValue];
[textValue release];
}
NSUInteger row=[indexPath row];
UILabel *textName=(UILabel *)[cell.contentView viewWithTag:NameValueTag];
textName.text=[listData objectAtIndex:row];