您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页Swift设置section高度为0的方法

Swift设置section高度为0的方法

来源:化拓教育网

只设置section高度而不做其它处理时,在OC下面找到

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

然后return 0.00001就可以了
但是,在swift中只是这样设置,是无效的,还要做如下处理

    public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        return UIView.init()
    }
    public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        return UIView.init()
    }

这样,就可将section的高度设置为0了。

不对的地方,还请各位多多指教。

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务