I'm trying to make a basic app my iPhone. I'm completely new to Xcode and I've had a browse on google and could not find exactly what I'm looking for. I'm trying to make a checklist for my plane.
I've basically got a View controller with several buttons on. And what I want is for the button to change from grey to blue once pressed and stay blue unless pressed again. I have no knowledge of Xcode and Swift language at all so if anyone could help please explain as if you're explaining to a kid.
So far I've managed to get the pages all setup and scrolling working but I just need the buttons to change now.
Thank you in advance, Ty.
Use this method of UIButton class
func setTitleColor(_ color: UIColor?,
forState state: UIControlState)
The state you are looking for is .Selected
And of course you have to handle selected state by yourself as a toggle button is not a native behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With