ios - How do I set UIButton background color forState: UIControlState.Highlighted in Swift -


After

I can set the background color for a button, but I can not work out to set the background color Method UIControlState.Highlighted . Is this possible? Or do I need to go down the setBackgroundImage path?

One way to go will be two IBActions when pressing a button on a button, release a background color Controlling

  Import UIKit Class ViewController:. UIViewController {@IBOutlet Weak Up Button: UIButton! ButtonClicked function @IBAction (this: AnyObject) {// touch action button.backgroundColor = UIColor.blueColor )} Override Function ViewDidLoad () {super.viewDidLoad ()}} After adding the duration, you see a complete option for your button, you can set a background color But not for the specified state you can only set the background images now obviously if you like this Instead of doing the method I'm marrying using above show, you can load an image of the desired color as the background image using the setbackgroundImageForState property. 

Enter image details here


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -