美文网首页
iPhoneX中,设置heightForHeaderInSect

iPhoneX中,设置heightForHeaderInSect

作者: S型身材的猪 | 来源:发表于2017-11-01 18:02 被阅读55次

本人在设置tableView的区头高度时,发现在iPhoneX下无效,明明设置了10,结果看起来比1还小,然后改成100也同样无效

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 10.0;
}

解决办法:再添加一个代理方法

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    return [UIView new];
}

区头高度如此,区尾高度亦如此,反正设置高度时,要保证区头,区头高度,区尾,区尾高度的代理方法成对出现即可

相关文章

网友评论

      本文标题:iPhoneX中,设置heightForHeaderInSect

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