MessageDetailesView.swift 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // MessageDetailesView.swift
  3. // RainbowPlanet
  4. //
  5. // Created by 南鑫林 on 2019/4/25.
  6. // Copyright © 2019 南鑫林. All rights reserved.
  7. //
  8. import UIKit
  9. class MessageDetailesView: BaseView {
  10. override func setupViews() {
  11. addSubview(tableView)
  12. }
  13. override func setupLayouts() {
  14. tableView.snp.makeConstraints { (make) in
  15. make.edges.equalToSuperview()
  16. }
  17. }
  18. private lazy var tableView: UITableView = {
  19. let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
  20. tableView.backgroundColor = kf7f8faColor
  21. tableView.delegate = self
  22. tableView.dataSource = self
  23. tableView.estimatedRowHeight = 102
  24. tableView.rowHeight = UITableView.automaticDimension
  25. tableView.separatorStyle = .none
  26. return tableView
  27. }()
  28. }
  29. extension MessageDetailesView: UITableViewDelegate,UITableViewDataSource {
  30. func numberOfSections(in tableView: UITableView) -> Int {
  31. return 5
  32. }
  33. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  34. return 1
  35. }
  36. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  37. let cell = MessageDetailesTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
  38. return cell
  39. }
  40. func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  41. let headerView = MessageDetailesTimeView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 55))
  42. return headerView
  43. }
  44. func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  45. return 55
  46. }
  47. func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
  48. return nil
  49. }
  50. func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
  51. return 0.0000001
  52. }
  53. }