Commit f9055eff authored by Steven杜宇's avatar Steven杜宇

// 我的好友显示

parent 1870246c
...@@ -130,7 +130,6 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -130,7 +130,6 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFriendsCell.cellReuseIdentifier, for: indexPath) as! YHMyFriendsCell
self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1)
if 0 <= indexPath.row && indexPath.row < friendsArr.count { if 0 <= indexPath.row && indexPath.row < friendsArr.count {
let friend = self.friendsArr[indexPath.row] let friend = self.friendsArr[indexPath.row]
cell.friendModel = friend cell.friendModel = friend
...@@ -138,11 +137,15 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource { ...@@ -138,11 +137,15 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
return cell return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section == 1 { if indexPath.section == 1 {
return 101 self.createCorner(cell: cell, isLastCell: indexPath.row == self.friendsArr.count-1)
}
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension return UITableView.automaticDimension
} }
......
...@@ -35,7 +35,14 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -35,7 +35,14 @@ class YHMyFriendsCell: UITableViewCell {
text1 = text1Arr.joined(separator: " | ") text1 = text1Arr.joined(separator: " | ")
} }
self.professionalLabel.text = text1 self.professionalLabel.text = text1
let topMargin = self.friendModel.signature.isEmpty ? 0.0 : 6.0
let detailHeight = self.friendModel.signature.isEmpty ? 0.0 : 18.0
self.detailLabel.snp.updateConstraints { make in
make.height.equalTo(detailHeight)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(topMargin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
} }
} }
...@@ -141,8 +148,8 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -141,8 +148,8 @@ class YHMyFriendsCell: UITableViewCell {
self.detailLabel.snp.makeConstraints { make in self.detailLabel.snp.makeConstraints { make in
make.left.equalTo(self.nameLabel) make.left.equalTo(self.nameLabel)
make.right.equalTo(self.lineView) make.right.equalTo(self.lineView)
make.height.equalTo(18.0)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(6) make.top.equalTo(self.professionalLabel.snp.bottom).offset(6)
make.height.equalTo(18)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment