美文网首页
tableView预留白条,分隔缝,留白解决方法.

tableView预留白条,分隔缝,留白解决方法.

作者: AAup | 来源:发表于2016-05-31 21:05 被阅读215次
    tableView预留白条,分隔缝,留白

    3种解决方案
    1,ios7后自动适应会留白;
    加入self.navigationController.navigationBar.translucent = NO;可以解决

    2.第一种方法不行;

    • (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
      //例子1
      return 0;
      //例子2
      // if (section==1) {
      // return 0;
      // }
      // return 10;//其他的距离

    }

    3第二种都不行;
    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    switch (indexPath.row) {
        case 1:
            return  kHeight(187);
            break;
        case 2:
            return kHeight(115+5);
            break;
      
        default:
            break;
    }
    

    //多个indexPath.row设置好后改为零
    return 20;//这为错误.改为零,

    }

    相关文章

      网友评论

          本文标题:tableView预留白条,分隔缝,留白解决方法.

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