You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
52 lines
1.6 KiB
// |
|
// UITableView+Extensions.swift |
|
// FireBoltt |
|
// |
|
// Created by lemo on 2018/6/3. |
|
// Copyright © 2020年 ecell. All rights reserved. |
|
// |
|
|
|
import Foundation |
|
|
|
extension UITableView { |
|
|
|
/// 设置grouped类型顶部距离以及段距离默认为15.0 |
|
func groupedDefaultHeaderAndFooterHeight() { |
|
self.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: kScaleHeight(10.0))) |
|
self.sectionHeaderHeight = kScaleHeight(15.0) |
|
self.sectionFooterHeight = kScaleHeight(0.01) |
|
} |
|
|
|
/// 设置grouped类型顶部距离为0以及段距离默认为15.0 |
|
func groupedDefaultHeaderZero() { |
|
self.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0.01)) |
|
self.sectionHeaderHeight = kScaleHeight(15.0) |
|
self.sectionFooterHeight = kScaleHeight(0.01) |
|
} |
|
|
|
/// 设置plain类型顶部距离默认为10.0,隐藏多余cell |
|
func plainDefaultHeaderAndHideCell() { |
|
self.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: kScaleHeight(10.0))) |
|
self.tableFooterView = UIView() |
|
} |
|
|
|
/// 隐藏多余的cell |
|
func hideCell() { |
|
self.tableFooterView = UIView() |
|
} |
|
|
|
/// 无数据处理 |
|
func noDataHandle(count: Int, tip: String?, type: NoDataType) { |
|
if count > 0 { |
|
tableFooterView = UIView() |
|
return |
|
} |
|
tableFooterView = NoDataView(frame: CGRect(x: 0, y: 0, width: width, height: height), tip: tip, type: type) |
|
} |
|
|
|
/// 默认颜色 |
|
func setDefultColor() { |
|
self.backgroundColor = kHexColor(0xC5D0DB, 0.2) |
|
} |
|
|
|
}
|
|
|