Commit d31a9131 authored by David黄金龙's avatar David黄金龙

工作经验信息 主界面 及 cell 字体和颜色修改

parent 96f0124a
......@@ -42,8 +42,8 @@ class YHInformationPerfectModel {
}
var status : String = ""
var color : UIColor = .red
var statusColor : UIColor = .red
var color : UIColor = .failColor
var statusColor : UIColor = .failColor
var isFinished : Bool = false {
didSet {
status = isFinished ? "已完成" : "待完善"
......
......@@ -60,7 +60,7 @@ class YHItemView: UIView {
showPromptLabel = {
let label = UILabel()
label.textColor = UIColor.red
label.textColor = UIColor.failColor
label.font = UIFont.PFSC_M(ofSize: 12)
return label
}()
......
......@@ -77,12 +77,13 @@ class YHWorkExperienceListViewController: YHBaseViewController {
bottomButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2274ee)
// button.backgroundColor = UIColor(hex:0x2274ee)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button.contentHorizontalAlignment = .center
button.setTitle("提交", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 6
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
}()
......@@ -93,6 +94,9 @@ class YHWorkExperienceListViewController: YHBaseViewController {
make.height.equalTo(48)
make.left.equalTo(16)
}
bottomButton.layoutIfNeeded()
bottomButton.addYinHeGradualLayer()
}
@objc func submit() {
......
......@@ -58,7 +58,7 @@ class YHWorkActionView: UIView {
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 13)
button.contentHorizontalAlignment = .center
button.setTitle("参考示例", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.setImage(UIImage(named: "work_experience_example"), for: .normal)
button.imageEdgeInsets = UIEdgeInsets(top: 2, left: 0, bottom: 2, right: 58)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
......
......@@ -75,11 +75,11 @@ class YHWorkExampleMessageTableViewCell: UITableViewCell {
useButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x2f7ef6).withAlphaComponent(0.08)
button.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.08)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
button.contentHorizontalAlignment = .center
button.setTitle("使用此模板", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = 3
button.addTarget(self, action: #selector(submit), for: .touchUpInside)
return button
......
......@@ -68,7 +68,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 16)
label.font = UIFont.PFSC_M(ofSize: 17)
label.text = "主申请人工作经历"
label.textColor = UIColor.mainTextColor
return label
......@@ -85,7 +85,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.text = "(从最近一份全职工作开始,直至毕业后的第一份工作)"
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
centerView.addSubview(subTitleLabel)
......@@ -101,7 +101,7 @@ class YHWorkExperienceListTableViewCell: UITableViewCell {
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("取消操作", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(cannal), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -50,7 +50,7 @@ class YHWorkFileItemView: UIView {
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.setTitleColor( UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -91,7 +91,7 @@ class YHWorkIntroductionItemView: UIView {
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.setTitleColor( UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -85,7 +85,7 @@ class YHWorkIntroductionTableViewCell: UITableViewCell {
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("取消操作", for: .normal)
button.setTitleColor( UIColor(hex:0x2f7ef6), for: .normal)
button.setTitleColor( UIColor.brandMainColor, for: .normal)
button.addTarget(self, action: #selector(cannal), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -22,9 +22,9 @@ class YHWorkItemView: UIView {
var showPrompt: Bool = false {
didSet {
if showPrompt {
explainLabel.textColor = .red
explainLabel.textColor = UIColor.failColor
} else {
explainLabel.textColor = UIColor.subTextColor
explainLabel.textColor = UIColor.labelTextColor2
}
}
}
......@@ -47,7 +47,7 @@ class YHWorkItemView: UIView {
func setUpView() {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.font = UIFont.PFSC_B(ofSize: 14)
label.textAlignment = .left
label.textColor = UIColor.mainTextColor
return label
......@@ -64,7 +64,7 @@ class YHWorkItemView: UIView {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 12)
label.textAlignment = .left
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(subTitleLabel)
......@@ -76,9 +76,9 @@ class YHWorkItemView: UIView {
explainLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.font = UIFont.PFSC_R(ofSize: 12)
label.textAlignment = .right
label.textColor = UIColor.subTextColor
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(explainLabel)
......@@ -118,7 +118,7 @@ class YHWorkItemView: UIView {
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.contentHorizontalAlignment = .right
button.setTitleColor( UIColor(hex:0xf81d22), for: .normal)
button.setTitleColor(UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
......
......@@ -59,205 +59,5 @@ extension UIViewController {
return classType.init()
}
func bs_popToRootViewController(animated: Bool) {
let vcs = self.navigationController?.popToRootViewController(animated: true)
if vcs != nil {
self.tabBarController?.tabBar.isHidden = false
}
}
}
// MARK: - 创建RightBarButtonItem
extension UIViewController {
public func bs_setupRightButton(title: String? = nil, color: UIColor? = nil, image: UIImage? = nil, font: UIFont? = nil, imageColor: UIColor? = nil, reset: Bool = false) {
var button: UIButton?
if let rightBarButtonItems = self.navigationItem.rightBarButtonItems,
rightBarButtonItems.count > 0,
reset == false {
for view in rightBarButtonItems {
if let rightButton = view.customView as? UIButton {
button = rightButton
}
}
} else {
let rightButton = UIButton(type: .custom)
rightButton.frame = CGRect(x: 0, y: 0, width: 70, height: 44)
rightButton.addTarget(self, action: #selector(clickedNavRight), for: .touchUpInside)
rightButton.contentHorizontalAlignment = .right
let rightItem = UIBarButtonItem(customView: rightButton)
let negativeSeperator = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
negativeSeperator.width = -0
self.navigationItem.rightBarButtonItems = [negativeSeperator,rightItem]
button = rightButton
}
if font == nil {
button?.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
} else {
button?.titleLabel?.font = font
}
if var image = image {
if let imageColor = imageColor {
image = image.withRenderingMode(.alwaysTemplate)
button?.tintColor = imageColor
} else {
image = image.withRenderingMode(.alwaysOriginal)
}
button?.setImage(image, for: .normal)
button?.setImage(image, for: .highlighted)
}
button?.setTitle(title, for: .normal)
button?.setTitleColor(color, for: .normal)
}
@objc func clickedNavRight() {
}
}
// MARK: - 配置导航栏
extension UIViewController {
public func bs_config() {
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.setNavigationBarHidden(false, animated: true)
self.bs_setupNavigationAttributed(.white)
self.bs_setupTitleAttributedAll()
self.bs_setupLeftButton()
self.bs_openPopGesture()
}
///设置导航条属性
func bs_setupNavigationAttributed(_ color: UIColor = UIColor.white) {
//设置状态栏
//UIApplication.shared.statusBarStyle = .default
//self.preferredStatusBarStyle = .default
self.navigationController?.navigationBar.barTintColor = color
self.navigationController?.navigationBar.setBackgroundImage(UIImage.from(color: color), for: .default)
self.navigationController?.navigationBar.shadowImage = UIImage() //隐藏下划线
}
///设置全局标题属性
func bs_setupTitleAttributedAll(font: UIFont = UIFont.PFSC_M(ofSize: 16), color: UIColor = .black) {
let titleDict = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: color]
self.navigationController?.navigationBar.titleTextAttributes = titleDict
}
///设置独立标题属性
func bs_setupTitleAttributed(title: String, font: UIFont = UIFont.PFSC_M(ofSize: 16), color: UIColor = .black, reset: Bool = false) {
var titleLabel: UILabel?
if let label = self.navigationItem.titleView as? UILabel,
reset == false {
titleLabel = label
} else {
let label = UILabel()
titleLabel = label
}
titleLabel?.font = font
titleLabel?.textColor = color
titleLabel?.text = title
self.navigationItem.titleView = titleLabel
}
///返回按钮
func bs_setupLeftButton(title: String? = nil, color: UIColor? = nil, image: UIImage? = UIImage(named: "back_icon"), reset: Bool = false) {
var button: UIButton?
if let leftBarButtonItems = self.navigationItem.leftBarButtonItems,
leftBarButtonItems.count > 0,
reset == false {
for view in leftBarButtonItems {
if let leftButton = view.customView as? UIButton {
button = leftButton
}
}
} else {
let leftButton = UIButton(type: .custom)
leftButton.frame = CGRect(x: 0, y: 0, width: 44, height: 44)
leftButton.addTarget(self, action: #selector(callBackAction), for: .touchUpInside)
leftButton.contentHorizontalAlignment = .left
leftButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: -4, bottom: 0, right: 0)
let leftItem = UIBarButtonItem(customView: leftButton)
let negativeSeperator = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
negativeSeperator.width = -0
self.navigationItem.leftBarButtonItems = [negativeSeperator,leftItem]
button = leftButton
}
var image = image
if color != nil {
image = image?.withRenderingMode(.alwaysTemplate)
} else {
image = image?.withRenderingMode(.alwaysOriginal)
}
button?.setImage(image, for: .normal)
button?.setImage(image, for: .highlighted)
button?.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
button?.setTitle(title, for: .normal)
button?.setTitleColor(color, for: .normal)
button?.tintColor = color
}
///返回按钮响应
@objc func callBackAction() {
let selector = NSSelectorFromString("onCallBackAction")
if self.responds(to: selector) == true {
self.performSelector(onMainThread: selector, with: nil, waitUntilDone: false)
} else {
self.navigationController?.popViewController(animated: true)
}
}
/**
打开系统手势返回
*/
@objc func bs_openPopGesture() {
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
/**
关闭系统手势返回
*/
@objc func bs_closePopGesture() {
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
}
///修改导航栏背景色(全局)
public func bs_navBackgroundColor(_ color: UIColor) {
self.navigationController?.view.backgroundColor = color
//解决iOS13后backgroundColor设置无效的问题,参考https://developer.apple.com/forums/thread/682420
if #available(iOS 13.0, *) {
let newAppearance = UINavigationBarAppearance()
newAppearance.configureWithOpaqueBackground()
newAppearance.backgroundColor = color
newAppearance.shadowImage = UIImage()
newAppearance.shadowColor = nil
//newAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 20, weight: .medium)]
let appearance = self.navigationController?.navigationBar ?? UINavigationBar.appearance()
appearance.standardAppearance = newAppearance
appearance.scrollEdgeAppearance = appearance.standardAppearance
} else {
bs_setupNavigationAttributed(color)
}
}
}
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