TableViewUtil.swift 844 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // TableViewUtil.swift
  3. // HCQuanfangtong
  4. //
  5. // Created by Apple on 2021/12/29.
  6. // Copyright © 2021 Jyp. All rights reserved.
  7. //
  8. import UIKit
  9. extension UITableView{
  10. func register<T>(withType type : T.Type) where T : UITableViewCell{
  11. self.register(UINib.loadNib(type), forCellReuseIdentifier: String(describing: type))
  12. }
  13. func registerClass<T>(withType type: T.Type) where T : UITableViewCell{
  14. self.register(type, forCellReuseIdentifier: String(describing: type))
  15. }
  16. func dequeueReusableCell<T>(withType type : T.Type) -> T where T: UITableViewCell{
  17. return self.dequeueReusableCell(withIdentifier: String(describing: type)) as! T
  18. }
  19. /// tableView plain 隐藏掉分割线
  20. func hiddenExtraCellLine(){
  21. self.tableFooterView = UIView.init()
  22. }
  23. }