私聊的vm
This commit is contained in:
@@ -3,27 +3,64 @@
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by MaiMang on 2024/2/25.
|
||||
//
|
||||
// 回话详情
|
||||
|
||||
import UIKit
|
||||
|
||||
import NIMSDK
|
||||
class ChatVC: BaseViewController {
|
||||
|
||||
public init(session: NIMSession) {
|
||||
vm = ChatViewModel(session: session)
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
// vm.delegate = self
|
||||
// NIMSDK.shared().mediaManager.add(self)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
var vm:ChatViewModel
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = .orange
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// MARK: - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
// Get the new view controller using segue.destination.
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
private lazy var chatTableView: UITableView = {
|
||||
let tableView = UITableView(frame: .zero, style: .plain)
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
tableView.tableFooterView = UIView()
|
||||
tableView.separatorStyle = .none
|
||||
tableView.backgroundColor = .clear
|
||||
if #available(iOS 11.0, *) {
|
||||
tableView.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
return tableView
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
extension ChatVC: UITableViewDelegate, UITableViewDataSource {
|
||||
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return vm.messageObjects.count
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView,
|
||||
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
return UITableViewCell()
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView,
|
||||
heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
let m = vm.messageObjects[safe:indexPath.row]
|
||||
return CGFloat(m?.height ?? 0)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user