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

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

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