Commit 7c7f9773 authored by pete谢兆麟's avatar pete谢兆麟

修改tips为空的图片选择控件

parent b8c11663
...@@ -37,9 +37,9 @@ class YHAdopterIncomeDetailViewController: YHBaseViewController { ...@@ -37,9 +37,9 @@ class YHAdopterIncomeDetailViewController: YHBaseViewController {
} }
for item in resultModels { for item in resultModels {
var tempFile = YHWorkExperienceFileModel() var tempFile = YHWorkExperienceFileModel()
tempFile.fileName = item.name ?? "" tempFile.fileName = item.name
tempFile.fileUrl = item.url ?? "" tempFile.fileUrl = item.url
tempFile.uploadedAt = item.upload_date ?? "" tempFile.uploadedAt = item.upload_date
file.append(tempFile) file.append(tempFile)
} }
tableView.reloadData() tableView.reloadData()
......
...@@ -44,7 +44,11 @@ class YHCertificateUploadSheetView: UIView { ...@@ -44,7 +44,11 @@ class YHCertificateUploadSheetView: UIView {
// 决定最终图片选择数量最大值 赋值时先赋值 imageMaxCount 后赋值 maxSelectImageCount // 决定最终图片选择数量最大值 赋值时先赋值 imageMaxCount 后赋值 maxSelectImageCount
var imageMaxCount: Int = 9 var imageMaxCount: Int = 9
var tips = "支持的文件格式为jpg/jpeg、png、doc/docx、pptx、pdf,最多可上传99张图片或文件" var tips = "支持的文件格式为jpg/jpeg、png、doc/docx、pptx、pdf,最多可上传99张图片或文件" {
didSet {
updateLayouts()
}
}
// 外部根据业务在0~imageMaxCount之间变动 // 外部根据业务在0~imageMaxCount之间变动
var maxSelectImageCount = 9 { var maxSelectImageCount = 9 {
...@@ -88,10 +92,7 @@ class YHCertificateUploadSheetView: UIView { ...@@ -88,10 +92,7 @@ class YHCertificateUploadSheetView: UIView {
let view = UIView() let view = UIView()
view.addSubview(titleLabel) view.addSubview(titleLabel)
view.addSubview(closeBtn) view.addSubview(closeBtn)
view.addSubview(lineView)
let line = UIView()
line.backgroundColor = .separatorColor
view.addSubview(line)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
...@@ -103,7 +104,7 @@ class YHCertificateUploadSheetView: UIView { ...@@ -103,7 +104,7 @@ class YHCertificateUploadSheetView: UIView {
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.width.height.equalTo(24) make.width.height.equalTo(24)
} }
line.snp.makeConstraints { make in lineView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.height.equalTo(1) make.height.equalTo(1)
...@@ -122,6 +123,12 @@ class YHCertificateUploadSheetView: UIView { ...@@ -122,6 +123,12 @@ class YHCertificateUploadSheetView: UIView {
return label return label
}() }()
lazy var lineView: UIView = {
let label = UIView()
label.backgroundColor = UIColor.separatorColor
return label
}()
lazy var closeBtn: UIButton = { lazy var closeBtn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setImage(UIImage(named:"my_cer_sheet_close"), for: .normal) btn.setImage(UIImage(named:"my_cer_sheet_close"), for: .normal)
...@@ -224,6 +231,25 @@ class YHCertificateUploadSheetView: UIView { ...@@ -224,6 +231,25 @@ class YHCertificateUploadSheetView: UIView {
} }
func updateLayouts() {
let whiteHeight = calculateHeight()
whiteContentView.snp.remakeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(whiteHeight)
}
topView.snp.remakeConstraints { make in
make.top.left.right.equalToSuperview()
}
tableView.snp.remakeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(topView.snp.bottom).offset(0)
}
if tips == "" {
lineView.isHidden = true
}
}
func calculateHeight() -> CGFloat { func calculateHeight() -> CGFloat {
// 注意事项文字高度 // 注意事项文字高度
...@@ -235,7 +261,10 @@ class YHCertificateUploadSheetView: UIView { ...@@ -235,7 +261,10 @@ class YHCertificateUploadSheetView: UIView {
descHeight = ceil(descHeight)+21+34 descHeight = ceil(descHeight)+21+34
// 底部四个操作行高度之和 // 底部四个操作行高度之和
let actionsHeight = 52.0 * 4.0 let actionsHeight = 52.0 * 4.0
let tableViewHeight = descHeight+actionsHeight var tableViewHeight = descHeight+actionsHeight
if tips == "" {
tableViewHeight = actionsHeight
}
// 白色View总高度 // 白色View总高度
var totalHeight = 53.0+tableViewHeight+k_Height_safeAreaInsetsBottom() var totalHeight = 53.0+tableViewHeight+k_Height_safeAreaInsetsBottom()
if totalHeight > KScreenHeight { if totalHeight > KScreenHeight {
...@@ -319,13 +348,16 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour ...@@ -319,13 +348,16 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
label.numberOfLines = 0 label.numberOfLines = 0
label.text = tips label.text = tips
view.addSubview(label) view.addSubview(label)
if tips == "" {
} else {
label.snp.makeConstraints { make in label.snp.makeConstraints { make in
make.top.equalToSuperview().offset(21) make.top.equalToSuperview().offset(21)
make.left.equalToSuperview().offset(20) make.left.equalToSuperview().offset(20)
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
make.bottom.equalToSuperview().offset(-34) make.bottom.equalToSuperview().offset(-34)
} }
}
return view return view
} }
......
...@@ -249,7 +249,7 @@ extension YHResignCertificateDetailEVisaViewController: UITableViewDelegate, UIT ...@@ -249,7 +249,7 @@ extension YHResignCertificateDetailEVisaViewController: UITableViewDelegate, UIT
cell.newFileBlock = {[weak self] in cell.newFileBlock = {[weak self] in
guard let self = self else { return } guard let self = self else { return }
let sheetView = YHCertificateUploadSheetView.sheetView() let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.tips = "支持的文件格式为jpg/jpeg、png、pdf,最多可上传1张图片或文件" sheetView.tips = ""
sheetView.maxSelectImageCount = 1 sheetView.maxSelectImageCount = 1
sheetView.fileTypes = [ "public.image", sheetView.fileTypes = [ "public.image",
"com.adobe.pdf"] "com.adobe.pdf"]
......
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