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

// 我的好友

parent e5d91dbf
......@@ -83,6 +83,7 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHAddFriendCardCell.cellReuseIdentifier, for: indexPath) as! YHAddFriendCardCell
cell.cardCount = self.friendRequestArr.count
cell.acceptBlock = {
[weak self] accept in
guard let self = self else { return }
......@@ -132,6 +133,21 @@ extension YHMyGoodFriendsVC: UITableViewDelegate, UITableViewDataSource {
return 0.1
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 0 {
if friendRequestArr.count > 0 {
return 12
}
return 0.1
}
return 0.1
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
......
......@@ -8,11 +8,36 @@
import UIKit
class YHAddFriendCardCell: UITableViewCell {
static let cellReuseIdentifier = "YHAddFriendCardCell"
let secondCardColor = UIColor(hex: 0xF0F4FB)
let thirdCardColor = UIColor(hex: 0xBBBBBB, alpha: 0.1)
var acceptBlock:((Bool)->())?
var cardCount:Int = 1 {
didSet {
var firstCardBottomMargin = 0.0
var secondCardBottomMargin = 0.0
if self.cardCount <= 1 {
} else if self.cardCount == 2 {
firstCardBottomMargin = -6.0
} else {
firstCardBottomMargin = -6.0
secondCardBottomMargin = -6.0
}
self.cardView.snp.updateConstraints { make in
make.bottom.equalTo(self.secondCardView).offset(firstCardBottomMargin)
}
self.secondCardView.snp.updateConstraints { make in
make.bottom.equalTo(self.thirdCardView).offset(secondCardBottomMargin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
static let height = 218.0
......@@ -99,6 +124,20 @@ class YHAddFriendCardCell: UITableViewCell {
return btn
}()
lazy var secondCardView:UIView = {
let view = UIView()
view.backgroundColor = self.secondCardColor
view.layer.cornerRadius = 3.0
return view
}()
lazy var thirdCardView:UIView = {
let view = UIView()
view.backgroundColor = self.thirdCardColor
view.layer.cornerRadius = 3.0
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
createUI()
......@@ -118,6 +157,10 @@ class YHAddFriendCardCell: UITableViewCell {
func createUI() {
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
self.contentView.addSubview(thirdCardView)
self.contentView.addSubview(secondCardView)
self.contentView.addSubview(cardView)
cardView.addSubview(bgImageView)
......@@ -139,7 +182,8 @@ class YHAddFriendCardCell: UITableViewCell {
self.msgLabel.text = "资讯科技及电讯资资讯科技及电讯资资讯科技及电讯资资讯科技及讯科技及电讯资资讯科技及电讯资资讯科技及电讯资资讯科技及科技及电讯资资讯科技及讯科技及电讯资资讯科技及科技及电讯资资讯科技及讯科技及电讯资资讯科技及"
cardView.snp.makeConstraints { make in
make.edges.equalToSuperview()
make.left.right.top.equalToSuperview()
make.bottom.equalTo(self.secondCardView).offset(-6)
}
bgImageView.snp.makeConstraints { make in
......@@ -207,6 +251,20 @@ class YHAddFriendCardCell: UITableViewCell {
make.centerY.equalTo(self.ignoreBtn)
make.height.equalTo(40)
}
self.secondCardView.snp.makeConstraints { make in
make.left.equalTo(self.cardView).offset(5)
make.right.equalTo(self.cardView).offset(-5)
make.height.equalTo(50)
make.bottom.equalTo(self.thirdCardView).offset(-6)
}
self.thirdCardView.snp.makeConstraints { make in
make.left.equalTo(self.cardView).offset(10)
make.right.equalTo(self.cardView).offset(-10)
make.bottom.equalToSuperview()
make.height.equalTo(50)
}
}
func getHeight(text:String, font:UIFont, width:CGFloat)->CGFloat {
......
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