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

// 人脉

parent b0d19ba9
...@@ -27,6 +27,7 @@ class YHMyFriendsCell: UITableViewCell { ...@@ -27,6 +27,7 @@ class YHMyFriendsCell: UITableViewCell {
lazy var headImgV:UIImageView = { lazy var headImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.layer.cornerRadius = 23.0 view.layer.cornerRadius = 23.0
view.clipsToBounds = true
return view return view
}() }()
......
...@@ -47,7 +47,18 @@ class YHNameCardInfoView: DragCardView { ...@@ -47,7 +47,18 @@ class YHNameCardInfoView: DragCardView {
} }
} }
self.professionalLabel.text = result self.professionalLabel.text = result
self.detailLabel.text = self.userModel.signature let detail = self.userModel.signature
self.detailLabel.text = detail
self.grayContentView.isHidden = detail.isEmpty
var detailHeight = self.getHeight(text: detail, font: self.detailLabel.font!, width: Self.width-18.0*2-16.0*2)
if detailHeight < 20.0 {
detailHeight = 20.0
} else if detailHeight > 40.0 {
detailHeight = 40.0
}
self.detailLabel.snp.updateConstraints { make in
make.height.equalTo(detailHeight)
}
self.signImgV.isHidden = (self.userModel.isSign != 1) self.signImgV.isHidden = (self.userModel.isSign != 1)
if self.userModel.isSendRequest { if self.userModel.isSendRequest {
...@@ -59,6 +70,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -59,6 +70,7 @@ class YHNameCardInfoView: DragCardView {
self.bottomBtn.backgroundColor = .brandMainColor self.bottomBtn.backgroundColor = .brandMainColor
self.bottomBtn.isUserInteractionEnabled = true self.bottomBtn.isUserInteractionEnabled = true
} }
} }
} }
...@@ -104,7 +116,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -104,7 +116,7 @@ class YHNameCardInfoView: DragCardView {
label.textAlignment = .center label.textAlignment = .center
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_R(ofSize:14) label.font = UIFont.PFSC_R(ofSize:14)
label.numberOfLines = 0 label.numberOfLines = 2
return label return label
}() }()
...@@ -120,7 +132,7 @@ class YHNameCardInfoView: DragCardView { ...@@ -120,7 +132,7 @@ class YHNameCardInfoView: DragCardView {
label.textColor = UIColor.mainTextColor50 label.textColor = UIColor.mainTextColor50
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:13) label.font = UIFont.PFSC_R(ofSize:13)
label.numberOfLines = 0 label.numberOfLines = 2
return label return label
}() }()
...@@ -218,19 +230,19 @@ class YHNameCardInfoView: DragCardView { ...@@ -218,19 +230,19 @@ class YHNameCardInfoView: DragCardView {
self.professionalLabel.snp.makeConstraints { make in self.professionalLabel.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(-18) make.right.equalTo(-18)
make.height.equalTo(20) make.height.lessThanOrEqualTo(40.0)
make.top.equalTo(self.nameLabel.snp.bottom).offset(8) make.top.equalTo(self.nameLabel.snp.bottom).offset(8)
} }
self.grayContentView.snp.makeConstraints { make in self.grayContentView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(-18) make.right.equalTo(-18)
make.height.equalTo(72)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(10) make.top.equalTo(self.professionalLabel.snp.bottom).offset(10)
} }
self.detailLabel.snp.makeConstraints { make in self.detailLabel.snp.makeConstraints { make in
make.left.top.equalTo(16) make.left.top.equalTo(16)
make.height.equalTo(20.0)
make.right.bottom.equalTo(-16) make.right.bottom.equalTo(-16)
} }
...@@ -238,8 +250,20 @@ class YHNameCardInfoView: DragCardView { ...@@ -238,8 +250,20 @@ class YHNameCardInfoView: DragCardView {
make.left.equalTo(18) make.left.equalTo(18)
make.right.equalTo(-18) make.right.equalTo(-18)
make.height.equalTo(46) make.height.equalTo(46)
make.top.equalTo(self.grayContentView.snp.bottom).offset(32) make.bottom.equalToSuperview().offset(-30)
} }
} }
func getHeight(text:String, font:UIFont, width:CGFloat)->CGFloat {
let attributes = [NSAttributedString.Key.font: font] as [NSAttributedString.Key : Any]
let boundingSize = (text as NSString).boundingRect(
with: CGSize(width: width, height: .greatestFiniteMagnitude),
options: .usesLineFragmentOrigin,
attributes: attributes,
context: nil
).size
let textHeight = ceill(boundingSize.height)
return textHeight
}
} }
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