So, I have two UITextFields
: name and amount and two UIButtons
: income, expense.
When I click the expense button, I want my text color to amount
change to red or green if the income button is pressed.
This only works if the text field amount
is in focus, if the text field name
is in focus, the color does not change for the quantity.
Is there a way to change the color of a text box if it is out of focus?
edit:
Here is my code where I change color:
@IBAction func typeBtnPressed(_ sender: UIButton) {
if sender.tag == Buttons.expense.rawValue {
amountTxt.textColor = .red
} else {
amountTxt.textColor = .green
}
}
source
share