只设置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了。
不对的地方,还请各位多多指教。
网友评论