ios开发:tableviewCell自适应

cell高度自适应

CGSize label2Size = [[_dataDic objectForKey:@"skill"] 
boundingRectWithSize:size options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:@{
NSFontAttributeName:[UIFont systemFontOfSize:14.0],
NSForegroundColorAttributeName:[UIColor blackColor]} context:nil].size;

CGRect frame = [string boundingRectWithSize:CGSizeMake(WIDTH - 15, CGFLOAT_MAX) 
options:NSStringDrawingUsesLineFragmentOrigin attributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil];
cell单个、单段刷新
cell单个刷新
//一个section刷新    
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];    
[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];    
//一个cell刷新    
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];    
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];  

你可能感兴趣的:(ios开发:tableviewCell自适应)