123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // SelfMentionContactsListView.swift
- // RainbowPlanet
- //
- // Created by 南鑫林 on 2019/4/25.
- // Copyright © 2019 南鑫林. All rights reserved.
- //
- import UIKit
- class SelfMentionContactsListView: BaseView {
-
- typealias DidSelectRowClosure = (_ indexPath: IndexPath) -> Void
- var didSelectRowClosure : DidSelectRowClosure?
-
- typealias EditTransClosure = (_ selfMentionContactsModel:SelfMentionContactsModel, _ listCount: Int) -> Void
- var editTransClosure: EditTransClosure?
-
- var selfMentionContactsModels: Array<SelfMentionContactsModel>? {
- didSet {
- tableView.reloadData()
- }
- }
-
- override func setupViews() {
- addSubview(tableView)
- let emptyView = DIYEmptyView.empty(with: kImage(name: "page04"), titleStr: nil, detailStr: "当前暂无数据,请添加新收货人")
- emptyView!.contentViewY = kScaleValue(value: 182)
- tableView.ly_emptyView = emptyView
- tableView.ly_startLoading()
- }
-
- override func setupLayouts() {
- tableView.snp.makeConstraints { (make) in
- make.edges.equalToSuperview()
- }
- }
-
- lazy var tableView: UITableView = {
- let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
- tableView.backgroundColor = kf7f8faColor
- tableView.delegate = self
- tableView.dataSource = self
- tableView.separatorStyle = .none
- tableView.estimatedRowHeight = 74
- return tableView
- }()
- }
- extension SelfMentionContactsListView: UITableViewDelegate,UITableViewDataSource {
-
-
- func numberOfSections(in tableView: UITableView) -> Int {
- return 1
- }
-
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return selfMentionContactsModels?.isEmpty ?? true ? 0 : selfMentionContactsModels?.count ?? 0
-
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = SelfMentionContactsListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
- cell.selfMentionContactsModel = selfMentionContactsModels?[indexPath.row]
- cell.editClosure = {
- [weak self] selfMentionContactsModel in
- if let editTransClosure = self?.editTransClosure {
- editTransClosure(selfMentionContactsModel, self?.selfMentionContactsModels?.count ?? 0)
- }
- }
- return cell
-
- }
-
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- if let didSelectRowClosure = self.didSelectRowClosure {
- didSelectRowClosure(indexPath)
- }
- }
-
- func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return UITableView.automaticDimension
- }
-
- func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- return nil
- }
-
-
- func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
- return 10
- }
-
- func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
- return nil
- }
-
- func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- return 0.0000001
- }
-
- }
|