Commit 2aee0be2 authored by Steven杜宇's avatar Steven杜宇

// 搜索栏

parent a8620c22
......@@ -198,6 +198,7 @@
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateResourceUploadVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateResourceUploadVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
049A48AA2B49536000D0C641 /* YHAboutUsAdvantageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */; };
04A671592B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */; };
......@@ -535,6 +536,7 @@
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateResourceUploadVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateResourceUploadVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
049A48A92B49536000D0C641 /* YHAboutUsAdvantageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsAdvantageCell.swift; sourceTree = "<group>"; };
04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCertificateUploadSheetView.swift; sourceTree = "<group>"; };
......@@ -1329,6 +1331,7 @@
children = (
04A671582B9F18C800C1FB91 /* YHCertificateUploadSheetView.swift */,
04A671612BA058DE00C1FB91 /* YHCertificateEditSheetView.swift */,
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */,
04A6715F2BA0280800C1FB91 /* YHFileRenameInputView.swift */,
04A6715D2B9FFCA700C1FB91 /* YHCertificateNameCell.swift */,
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */,
......@@ -2200,6 +2203,7 @@
045EEEFE2B9F171A0022A143 /* YHFormItemInputTextCell.swift in Sources */,
045EEEDD2B9F171A0022A143 /* YHCollegeNameCell.swift in Sources */,
045EEF162B9F171A0022A143 /* YHMainApplicantInformationViewController.swift in Sources */,
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */,
045EEEAA2B9F171A0022A143 /* YHWorkExampleViewController.swift in Sources */,
A5FD63C12B62616D00D1D9DA /* YHInformationPerfectModel.swift in Sources */,
045EEE912B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemView.swift in Sources */,
......
......@@ -31,6 +31,23 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
return tableView
}()
lazy var searchView:UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(searchBar)
searchBar.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: KScreenWidth-32.0, height:YHCertificateSearchBar.height))
}
return view
}()
lazy var searchBar: YHCertificateSearchBar = {
let bar = YHCertificateSearchBar(frame:CGRect(x: 0, y: 0, width:KScreenWidth-32, height:YHCertificateSearchBar.height))
return bar
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
......@@ -42,11 +59,18 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
func createUI() {
view.addSubview(tableView)
view.addSubview(searchView)
tableView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
}
searchView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(YHCertificateSearchBar.height+32)
}
}
}
......
//
// YHCertificateSearchBar.swift
// galaxy
//
// Created by edy on 2024/3/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCertificateSearchBar: UIView {
static let height = 40.0
static let cancelBtnHeight = height-8.0
var textChange:((String?)->Void)?
var cancelBlock:(()->Void)?
var placeHolder:String? {
didSet {
if let placeholder = placeHolder {
textField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
}
}
}
private lazy var contentView = {
let view = UIView()
view.backgroundColor = .contentBkgColor
view.layer.cornerRadius = Self.height/2.0
view.clipsToBounds = true
return view
}()
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.attributedPlaceholder = NSAttributedString(string: "请输入", attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
textField.font = UIFont.PFSC_M(ofSize: 12)
textField.tintColor = UIColor(hexString: "#3D88F8")
textField.textColor = UIColor.mainTextColor
textField.clearButtonMode = .whileEditing
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
return textField
}()
lazy var cancelBtn: UIButton = {
let btn = UIButton()
btn.setTitle("取消".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString: "#3D88F8")
btn.layer.cornerRadius = Self.cancelBtnHeight/2.0
btn.addTarget(self, action: #selector(cancelBtnClicked), for: .touchUpInside)
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.createUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
static func createBar() -> YHCertificateSearchBar {
let view = YHCertificateSearchBar(frame: CGRect(x: 0, y: 0, width: KScreenWidth-32, height: height))
return view
}
@objc func cancelBtnClicked() {
if let cancelBlock = cancelBlock {
cancelBlock()
}
}
func createUI() {
self.backgroundColor = .white
contentView.addSubview(textField)
contentView.addSubview(cancelBtn)
self.addSubview(contentView)
contentView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
textField.snp.makeConstraints { make in
make.left.equalToSuperview().offset(Self.height/2.0)
make.right.equalTo(cancelBtn.snp.left).offset(-4)
make.centerY.equalToSuperview()
}
cancelBtn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 66, height: Self.height-8.0))
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-4)
}
}
@objc func textFieldChanged(textField:UITextField) {
if let textChange = textChange {
textChange(textField.text)
}
}
}
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