UITableView iOS11

全局设置:

if  (@available(iOS 11.0, *)) {

/*typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior){

UIScrollViewContentInsetAdjustmentAutomatic, // 自动计算和适应顶部和底部的内边距并且在scrollView 不可滚动的情况下也设置内边距

UIScrollViewContentInsetAdjustmentScrollableAxes, // 自动计算内边距

UIScrollViewContentInsetAdjustmentNever, // 不计算内边距

UIScrollViewContentInsetAdjustmentAlways, // 根据safeAreaInsets来计算内边距

} API_AVAILABLE(ios(11.0),tvos(11.0));*/

        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];

        [[UITableView appearance] setEstimatedSectionFooterHeight:0.01];//默认段尾高度

        [[UITableView appearance] setEstimatedSectionHeaderHeight:0.01];//默认段头高度

}

UITableView:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

            return 0.01;

}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {

            return 8;

}

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

            return [UIView new];

}

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

            return [UIView new];

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容