Skip to content

Commit

Permalink
[Feat] CDS-Mobile1#27 - DMListTableView 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
joonBaek12 committed May 26, 2023
1 parent 578ca0d commit cafdb19
Showing 1 changed file with 61 additions and 25 deletions.
86 changes: 61 additions & 25 deletions Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ final class DMListViewController: BaseViewController {

// MARK: - Property


// MARK: - UI Property

let userNameLabel: UILabel = {
Expand All @@ -39,27 +37,37 @@ final class DMListViewController: BaseViewController {

let customNaviView = UIView()

private let searchTextField: UITextField = {
let textField = UITextField()
textField.backgroundColor = .gray5
textField.font = .body
//TODO: - 추후 placeholder 세팅 시 추가하겠습니다
// textField.placeholder = "검색"
return textField
// private let searchTextField: UITextField = {
// let textField = UITextField()
// textField.backgroundColor = .gray5
// textField.font = .body
// //TODO: - 추후 placeholder 세팅 시 추가하겠습니다
//// textField.placeholder = "검색"
// return textField
// }()

private let DMListTableView: UITableView = {
let tableView = UITableView()
tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier)
return tableView
}()



// MARK: - Life Cycle

override func viewDidLoad() {
super.viewDidLoad()

setSearchTextFieldUI()
// setSearchTextFieldUI()
configDelegate()
}

// MARK: - Setting

private func configDelegate() {
DMListTableView.delegate = self
DMListTableView.dataSource = self
}

override func setNavigationBar() {
super.setNavigationBar()

Expand Down Expand Up @@ -88,25 +96,53 @@ final class DMListViewController: BaseViewController {
$0.leading.trailing.equalToSuperview()
}

view.addSubview(searchTextField)
searchTextField.snp.makeConstraints {
$0.top.equalTo(customNaviView.snp.bottom).offset(8)
$0.centerX.equalToSuperview()
$0.leading.equalToSuperview().offset(16)
$0.height.equalTo(35)
// view.addSubview(searchTextField)
// searchTextField.snp.makeConstraints {
// $0.top.equalTo(customNaviView.snp.bottom).offset(8)
// $0.centerX.equalToSuperview()
// $0.leading.equalToSuperview().offset(16)
// $0.height.equalTo(35)
// }

view.addSubview(DMListTableView)
DMListTableView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
}

// MARK: - Action Helper

// MARK: - Custom Method

private func setSearchTextFieldUI() {

searchTextField.layer.cornerRadius = 10
searchTextField.backgroundColor = .gray5
searchTextField.font = .body
// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray])

// private func setSearchTextFieldUI() {
//
// searchTextField.layer.cornerRadius = 10
// searchTextField.backgroundColor = .gray5
// searchTextField.font = .body
//// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray])
//
// }
}

//MARK: - UITableViewDelegate
extension DMListViewController: UITableViewDelegate {

}

//MARK: - UITableViewDataSource
extension DMListViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: DMTableviewCell.identifier, for: indexPath) as! DMTableviewCell
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 74
}


}

0 comments on commit cafdb19

Please sign in to comment.