Commit ec99bfa8 authored by pete谢兆麟's avatar pete谢兆麟

按钮逻辑

parent 057b6c21
...@@ -19,9 +19,9 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell { ...@@ -19,9 +19,9 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
var rightButton: UIButton! var rightButton: UIButton!
var dataSource: Int?{ var dataSource: Int?{
didSet { didSet {
var flag = true var flag = false
if dataSource == 1 { if dataSource == 1 {
flag = false flag = true
} }
buttonState(isLeft: flag) buttonState(isLeft: flag)
} }
...@@ -158,14 +158,6 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell { ...@@ -158,14 +158,6 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
func buttonState(isLeft: Bool) { func buttonState(isLeft: Bool) {
if isLeft { if isLeft {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
leftButton.layer.borderColor = UIColor(hex: 0x2f7ef6).cgColor
leftButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
rightButton.backgroundColor = UIColor.contentBkgColor
rightButton.layer.borderWidth = 0
} else {
rightButton.isSelected = true rightButton.isSelected = true
leftButton.isSelected = false leftButton.isSelected = false
rightButton.layer.borderWidth = 1 rightButton.layer.borderWidth = 1
...@@ -173,6 +165,14 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell { ...@@ -173,6 +165,14 @@ class YHWorkMessageSelectTableViewCell: UITableViewCell {
rightButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08) rightButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
leftButton.backgroundColor = UIColor.contentBkgColor leftButton.backgroundColor = UIColor.contentBkgColor
leftButton.layer.borderWidth = 0 leftButton.layer.borderWidth = 0
} else {
leftButton.isSelected = true
rightButton.isSelected = false
leftButton.layer.borderWidth = 1
leftButton.layer.borderColor = UIColor(hex: 0x2f7ef6).cgColor
leftButton.backgroundColor = UIColor(hex: 0x2f7ef6).withAlphaComponent(0.08)
rightButton.backgroundColor = UIColor.contentBkgColor
rightButton.layer.borderWidth = 0
} }
} }
......
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