Commit 982a38b9 authored by pete谢兆麟's avatar pete谢兆麟

UI 细节修复

parent dc913ce3
......@@ -175,6 +175,20 @@ private extension YHResignUploadDocListViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 152)
}
}
func getHeight(_ value: String) -> CGFloat {
let text = value // 要显示的文本内容
let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
let maxWidth = KScreenWidth - 146 // 最大宽度限制
// 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text, attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度
let size = (text as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
return size.height
}
}
......@@ -241,9 +255,21 @@ extension YHResignUploadDocListViewController: UITableViewDelegate, UITableViewD
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if self.viewModel.mainModel.supplement_voucher_url.count == 0 {
if indexPath.section == 0 {
return CGFloat(52 * (self.viewModel.mainModel.upload_list.count + 1))
var height: CGFloat = 0
for item in self.viewModel.mainModel.upload_list {
height = height + 32
let value = getHeight(item.name)
height = height + value
}
return CGFloat(52 + height)
} else {
return CGFloat(52 * (self.viewModel.mainModel.doc_list.count + 1))
var height: CGFloat = 0
for item in self.viewModel.mainModel.doc_list {
height = height + 32
let value = getHeight(item.name)
height = height + value
}
return CGFloat(52 + height)
}
}
return 67
......
......@@ -104,6 +104,20 @@ class YHResignUploadDocListCell: UITableViewCell {
}
}
func getHeight(_ value: String) -> CGFloat {
let text = value // 要显示的文本内容
let font = UIFont.PFSC_B(ofSize: 14) // 字体大小
let maxWidth = KScreenWidth - 146 // 最大宽度限制
// 创建NSAttributedString对象并设置属性
let attributes = [NSAttributedString.Key.font : font] as [NSAttributedString.Key : Any]
_ = NSMutableAttributedString(string: text, attributes: attributes)
// 根据指定的最大宽度和字体大小计算文本的高度
let size = (text as NSString).boundingRect(with: CGSize(width: maxWidth, height: .greatestFiniteMagnitude), options: .usesLineFragmentOrigin, attributes: attributes, context: nil).size
return size.height
}
func updateAllViews() {
mainItemView.removeSubviews()
guard let dataSource = dataSource else {
......@@ -136,14 +150,15 @@ class YHResignUploadDocListCell: UITableViewCell {
} else {
itemView.docDataSource = dataSource[i]
}
let height = getHeight(dataSource[i].name)
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(total)
make.height.equalTo(51)
make.height.equalTo(height + 31)
make.right.equalTo(-18)
}
total = total + 51
total = total + Int(height + 31)
}
}
......
......@@ -172,7 +172,7 @@ class YHResignUploadTravelHKViewController: YHBaseViewController {
return false
}
if urls.last?.count == 0 {
failString = "请上传港澳通行证面"
failString = "请上传港澳通行证面"
return false
}
if self.viewModel.dataModel.issue_start.count == 0 {
......@@ -252,7 +252,7 @@ extension YHResignUploadTravelHKViewController: UITableViewDelegate, UITableView
cell.firstImageName = "service_adopter_card_travel_front"
cell.lastImageName = "service_adopter_card_travel_back"
cell.firstLabelName = "港澳通行证正面"
cell.lastLabelName = "港澳通行证面"
cell.lastLabelName = "港澳通行证面"
cell.dataModel = dataModel
cell.failString = failString
cell.data = data
......
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