Commit 3f495093 authored by lujunye's avatar lujunye

整理设置背景色方法

parent 6429fc57
...@@ -47,15 +47,15 @@ class DIYCalendarCell: FSCalendarCell { ...@@ -47,15 +47,15 @@ class DIYCalendarCell: FSCalendarCell {
self.contentView.layer.insertSublayer(selectionLayer, below: self.titleLabel!.layer) self.contentView.layer.insertSublayer(selectionLayer, below: self.titleLabel!.layer)
self.selectionLayer = selectionLayer self.selectionLayer = selectionLayer
self.shapeLayer.isHidden = true self.shapeLayer.isHidden = true
//下面代码为添加选中日期背景色 //下面代码为添加选中日期背景色
let selectionLayer2 = CAShapeLayer()
selectionLayer2.fillColor = color?.cgColor
selectionLayer2.actions = ["hidden": NSNull()]
self.contentView.layer.insertSublayer(selectionLayer2, below: selectionLayer)
self.selectionLayer2 = selectionLayer2
添加日期别景色1()
} }
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
...@@ -74,10 +74,9 @@ class DIYCalendarCell: FSCalendarCell { ...@@ -74,10 +74,9 @@ class DIYCalendarCell: FSCalendarCell {
// self.selectionLayer.path = UIBezierPath(rect: self.selectionLayer.bounds).cgPath // self.selectionLayer.path = UIBezierPath(rect: self.selectionLayer.bounds).cgPath
//下面代码为添加选中日期背景色 //下面代码为添加选中日期背景色
self.selectionLayer.fillColor = UIColor(named: "#E0EEFF")?.cgColor
let bounds = CGRect(x: 0, y: 2, width: self.selectionLayer.bounds.size.width, height: self.selectionLayer.bounds.height - 8)
self.selectionLayer.path = UIBezierPath(rect: bounds).cgPath let bounds = CGRect(x: 0, y: 2, width: self.selectionLayer.bounds.size.width, height: self.selectionLayer.bounds.height - 8)
添加日期背景色2(shaper: self.selectionLayer, rect: bounds, color: UIColor(named: "#E0EEFF")!)
} }
else if selectionType == .leftBorder { else if selectionType == .leftBorder {
self.titleLabel.textColor = UIColor.white self.titleLabel.textColor = UIColor.white
...@@ -87,9 +86,9 @@ class DIYCalendarCell: FSCalendarCell { ...@@ -87,9 +86,9 @@ class DIYCalendarCell: FSCalendarCell {
//下面代码为添加选中日期背景色 //下面代码为添加选中日期背景色
let bounds = CGRect(x: self.selectionLayer2.bounds.size.width*0.5, y: 2, width: self.selectionLayer2.bounds.size.width, height: self.selectionLayer2.bounds.height - 8) let bounds = CGRect(x: self.selectionLayer2.bounds.size.width*0.5, y: 2, width: self.selectionLayer2.bounds.size.width, height: self.selectionLayer2.bounds.height - 8)
self.selectionLayer2.fillColor = UIColor(named: "#E0EEFF")?.cgColor // self.selectionLayer2.fillColor = UIColor(named: "#E0EEFF")?.cgColor
self.selectionLayer2.path = UIBezierPath(rect: bounds).cgPath // self.selectionLayer2.path = UIBezierPath(rect: bounds).cgPath
添加日期背景色2(shaper: self.selectionLayer2, rect: bounds, color: UIColor(named: "#E0EEFF")!)
print("leftBorder--leftBorder") print("leftBorder--leftBorder")
} }
else if selectionType == .rightBorder { else if selectionType == .rightBorder {
...@@ -100,8 +99,7 @@ class DIYCalendarCell: FSCalendarCell { ...@@ -100,8 +99,7 @@ class DIYCalendarCell: FSCalendarCell {
//下面代码为添加选中日期背景色 //下面代码为添加选中日期背景色
let bounds = CGRect(x: 0, y: 2, width: self.selectionLayer2.bounds.size.width*0.5, height: self.selectionLayer2.bounds.height - 8) let bounds = CGRect(x: 0, y: 2, width: self.selectionLayer2.bounds.size.width*0.5, height: self.selectionLayer2.bounds.height - 8)
self.selectionLayer2.fillColor = UIColor(named: "#E0EEFF")?.cgColor 添加日期背景色2(shaper: self.selectionLayer2, rect: bounds, color: UIColor(named: "#E0EEFF")!)
self.selectionLayer2.path = UIBezierPath(rect: bounds).cgPath
}else if selectionType == .single { }else if selectionType == .single {
self.selectionLayer.fillColor = UIColor.init(named: "蓝色字体颜色")?.cgColor self.selectionLayer.fillColor = UIColor.init(named: "蓝色字体颜色")?.cgColor
...@@ -115,6 +113,18 @@ class DIYCalendarCell: FSCalendarCell { ...@@ -115,6 +113,18 @@ class DIYCalendarCell: FSCalendarCell {
} }
} }
func 添加日期别景色1(){
let selectionLayer2 = CAShapeLayer()
selectionLayer2.fillColor = UIColor(named: "蓝色字体颜色")?.cgColor
selectionLayer2.actions = ["hidden": NSNull()]
self.contentView.layer.insertSublayer(selectionLayer2, below: selectionLayer)
self.selectionLayer2 = selectionLayer2
}
func 添加日期背景色2(shaper:CAShapeLayer,rect:CGRect,color:UIColor){
shaper.fillColor = color.cgColor
shaper.path = UIBezierPath(rect: rect).cgPath
}
override func configureAppearance() { override func configureAppearance() {
super.configureAppearance() super.configureAppearance()
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/>
......
...@@ -21,6 +21,7 @@ class ADD_FXY_View: UIView { ...@@ -21,6 +21,7 @@ class ADD_FXY_View: UIView {
} }
var temp = "" var temp = ""
// var temp2 = ""
@objc func textChange(tf:UITextField){ @objc func textChange(tf:UITextField){
if tf == phoneTf { if tf == phoneTf {
if tf.text!.count <= 11 { if tf.text!.count <= 11 {
...@@ -35,7 +36,14 @@ class ADD_FXY_View: UIView { ...@@ -35,7 +36,14 @@ class ADD_FXY_View: UIView {
nameTf.text = "" nameTf.text = ""
nameTf.isUserInteractionEnabled = false nameTf.isUserInteractionEnabled = false
} }
delegate?.ADD_FXY_ViewTextInput(txt: tf.text!, type: 2,view:self) // if tf.text?.containsEmoji {
// HUD.flash(.label("请输入非表情符号"), delay: 1.2)
// tf.text = temp2
// return
// }else{
// temp2 = tf.text
// }
delegate?.ADD_FXY_ViewTextInput(txt: nameTf.text!, type: 2,view:self)
} }
} }
@IBAction func finish_action(_ sender: UIButton) { @IBAction func finish_action(_ sender: UIButton) {
......
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