私聊界面的UI完善
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
|
||||
import UIKit
|
||||
import NIMSDK
|
||||
class ChatVC: BaseViewController {
|
||||
class ChatVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
|
||||
// 键盘收起/弹出 滚动的时候收起输入栏
|
||||
private var isBecome: Bool = false
|
||||
/// 是否发送完成
|
||||
private var isSended: Bool = true
|
||||
/// 输入栏默认的高度
|
||||
private let ToolBarLastH: CGFloat = 52
|
||||
private let ToolBarLastH: CGFloat = (52 + SafeAraeBottomHeight)
|
||||
|
||||
public init(session: NIMSession) {
|
||||
vm = ChatViewModel(session: session)
|
||||
@@ -29,13 +29,19 @@ class ChatVC: BaseViewController {
|
||||
|
||||
var vm:ChatViewModel
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
.darkContent
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
view.backgroundColor = ThemeColor(hexStr: "#F6F6F6")
|
||||
let height = ScreenHeight - (ToolBarLastH + SafeAraeBottomHeight + NavHeight)
|
||||
chatTableView.frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: height)
|
||||
|
||||
let height = ScreenHeight - (ToolBarLastH + NavHeight)
|
||||
chatTableView.frame = CGRect(x: 0, y: NavHeight, width: ScreenWidth, height: height)
|
||||
navView.frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: NavHeight)
|
||||
view.addSubview(chatTableView)
|
||||
view.addSubview(keyboardView)
|
||||
view.addSubview(navView)
|
||||
}
|
||||
|
||||
///注册cell
|
||||
@@ -43,13 +49,15 @@ class ChatVC: BaseViewController {
|
||||
chatTableView.register(cellType: ChatTextCell.self)
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
tableView.backgroundColor = ThemeColor(hexStr: "#F8F8FB")
|
||||
if #available(iOS 11.0, *) {
|
||||
tableView.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
@@ -57,12 +65,20 @@ class ChatVC: BaseViewController {
|
||||
}()
|
||||
|
||||
private lazy var keyboardView: ChatKeyboardView = {
|
||||
let toolBarY = ScreenHeight - NavHeight - ToolBarLastH - SafeAraeBottomHeight
|
||||
let toolBarY = ScreenHeight - ToolBarLastH
|
||||
let view = ChatKeyboardView(frame: CGRect(x: 0, y: toolBarY, width: ScreenWidth, height: ToolBarLastH))
|
||||
view.backgroundColor = .white
|
||||
view.delegate = self
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
private lazy var navView: ChatNavView = {
|
||||
let view = ChatNavView(frame: .zero)
|
||||
view.backgroundColor = .white
|
||||
return view
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ChatKeyboardViewDelegate
|
||||
|
Reference in New Issue
Block a user