美文网首页
iOS UITableView设置section之间的距离

iOS UITableView设置section之间的距离

作者: 啵啵_long_港 | 来源:发表于2018-11-08 14:37 被阅读12次
    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    {
        if (section == 0) {
            return 0.1;
        }
        else if (section == 1)
        {
            return 0.1;
        }
        return 0.1;
    }
    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
    {
        return 0.1;
    }
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
    {
        UITableViewHeaderFooterView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"header"];
        if (header == nil) {
            header = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"header"];
        }
        return header;
    }
    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
    {
        UITableViewHeaderFooterView *footer = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"footer"];
        if (footer == nil) {
            footer = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"footer"];
        }
        return footer;
    }
    

    相关文章

      网友评论

          本文标题:iOS UITableView设置section之间的距离

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