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

// 我的名片

parent c805e4af
......@@ -13,7 +13,7 @@ class YHInterestTopicLayout: UICollectionViewFlowLayout {
var dataSource:[String] = []
weak var layoutDelegate: UICollectionViewDelegateFlowLayout? = nil
var interItemSpacing: CGFloat = 12.0 // 相邻单元格之间的水平间距
let collectionViewWidth = KScreenWidth-16.0*4
var collectionViewWidth = KScreenWidth-16.0*4
override func prepare() {
super.prepare()
self.minimumInteritemSpacing = 12
......
......@@ -143,18 +143,15 @@ class YHMyInterestTopicCell: UITableViewCell {
layout.scrollDirection = .vertical
layout.dataSource = self.topicArr
layout.layoutDelegate = self
layout.collectionViewWidth = KScreenWidth-16.0*4
return layout
}()
lazy var collectionView: UICollectionView = {
// 创建集合视图布局
// 创建集合视图
let collectView = UICollectionView(frame:.zero, collectionViewLayout: self.layout)
collectView.delegate = self
collectView.dataSource = self
collectView.backgroundColor = .white
// 注册自定义单元格
collectView.register(YHTopicItemCell.self, forCellWithReuseIdentifier: YHTopicItemCell.cellReuseIdentifier)
return collectView
}()
......
......@@ -31,7 +31,8 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: city)
self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20)
self.zodiacLabel.text = self.userModel.zodiac
self.signImgV.isHidden = !self.userModel.isSigned
var name:ASAttributedString = .init(string:self.userModel.username, .font(UIFont.PFSC_B(ofSize: 18)), .foreground(UIColor.mainTextColor))
let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))"
let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))"
......@@ -44,27 +45,38 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
}
self.nameTextView.attributed.text = name
var text1 = ""
if !self.userModel.position.isEmpty {
self.professionalLabel.text = self.userModel.position
text1 = self.userModel.position
} else {
self.professionalLabel.text = ""
if self.userModel.isCurrentUser {
if self.userModel.isCurrentUser { // 当前用户默认文案
self.professionalLabel.textColor = UIColor.mainTextColor30
self.professionalLabel.text = "填写职位 | 填写所属行业"
text1 = "填写职位 | 填写所属行业"
}
}
self.professionalLabel.text = text1
var text2 = ""
if !self.userModel.signature.isEmpty {
self.detailLabel.text = self.userModel.signature
text2 = self.userModel.signature
} else {
self.detailLabel.text = ""
if self.userModel.isCurrentUser {
if self.userModel.isCurrentUser { // 当前用户默认文案
self.detailLabel.textColor = UIColor.mainTextColor30
self.detailLabel.text = "填写个性签名,展现真我风采,彰显独特身份"
text2 = "填写个性签名,展现真我风采,彰显独特身份"
}
}
self.signImgV.isHidden = !self.userModel.isSigned
self.detailLabel.text = text2
var top2Margin = 8.0
if text2.isEmpty {
top2Margin = 0.0
} else {
top2Margin = text1.isEmpty ? 0.0 : 8.0
}
self.detailLabel.snp.updateConstraints { make in
make.top.equalTo(self.professionalLabel.snp.bottom).offset(top2Margin)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
......@@ -227,7 +239,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.professionalLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
// make.height.equalTo(20)
make.top.equalTo(self.nameTextView.snp.bottom).offset(0)
}
......@@ -235,7 +246,6 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(self.professionalLabel.snp.bottom).offset(8)
// make.height.equalTo(18)
make.bottom.equalTo(-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