Commit 4e482777 authored by Steven杜宇's avatar Steven杜宇

// 城市显示

parent 316aad51
...@@ -28,10 +28,18 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -28,10 +28,18 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
self.headImgV.image = UIImage(named: "people_head_default") self.headImgV.image = UIImage(named: "people_head_default")
} }
let city = self.userModel.address.city var cityStr = self.userModel.address.city
self.cityLabel.text = city var specialArea = ["北京市", "上海市", "天津市", "重庆市", "香港", "澳门", "台湾"]
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: city) for provinceName in specialArea {
if self.userModel.address.province.contains(provinceName) {
cityStr = self.userModel.address.province
break
}
}
self.cityLabel.text = cityStr
let cityWidth = self.getWith(font: self.cityLabel.font, height: 20, string: cityStr)
self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20) self.cityLabel.frame = CGRectMake(0, 0, cityWidth+8, 20)
self.zodiacLabel.text = self.userModel.zodiac self.zodiacLabel.text = self.userModel.zodiac
self.signImgV.isHidden = !self.userModel.isSigned self.signImgV.isHidden = !self.userModel.isSigned
...@@ -39,7 +47,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell { ...@@ -39,7 +47,7 @@ class YHMyNameCardAvatarInfoCell: UITableViewCell {
let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))" let cityTag: ASAttributedString = " \(.view(self.cityLabel, .original(.center)))"
let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))" let zodiacTag: ASAttributedString = " \(.view(self.zodiacLabel, .original(.center)))"
if !self.userModel.address.city.isEmpty { if !cityStr.isEmpty {
name += cityTag name += cityTag
} }
if !self.userModel.zodiac.isEmpty { if !self.userModel.zodiac.isEmpty {
......
...@@ -27,8 +27,12 @@ class YHNameCardInfoView: DragCardView { ...@@ -27,8 +27,12 @@ class YHNameCardInfoView: DragCardView {
// 城市文字 // 城市文字
var cityStr = self.userModel.address.city var cityStr = self.userModel.address.city
if cityStr.contains("区") { var specialArea = ["北京市", "上海市", "天津市", "重庆市", "香港", "澳门", "台湾"]
cityStr = self.userModel.address.province for provinceName in specialArea {
if self.userModel.address.province.contains(provinceName) {
cityStr = self.userModel.address.province
break
}
} }
if !cityStr.isEmpty { if !cityStr.isEmpty {
resultArr.append(cityStr) resultArr.append(cityStr)
......
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