美文网首页iOS开发经验总结
ios开发:tableviewCell自适应

ios开发:tableviewCell自适应

作者: SadMine | 来源:发表于2017-07-30 16:15 被阅读3次

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自适应

    本文链接:https://www.haomeiwen.com/subject/jmqklxtx.html