美文网首页
heightForRowAtIndexPath-设置cell的高

heightForRowAtIndexPath-设置cell的高

作者: js_huh | 来源:发表于2020-04-04 21:46 被阅读0次
  • - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    • UITableView 的代理方法
    • 作用: 手动设置指定cell的高度
       - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{    
        if((indexPath.row)%2 ==0){ //偶数行的cell高度 == 180;
            return 180;
          }else{
            return 100;
          }
      }
      
  • heightForRowAtIndexPath优化

相关文章

网友评论

      本文标题:heightForRowAtIndexPath-设置cell的高

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