aprofromindia
aprofromindia

Reputation: 1129

iOS Material Components MDCButton change Text color when button is pressed

I am using an MDCButton with a storyboard, how can I set the text color when the button is pressed (or in a highlighted state). I am using MDCSemanticColorScheme to set the color scheme of the button. Basically I need to contrast the titleColor with the inkColor.

Code of the button being initialised from Storyboard : -

import UIKit
import MaterialComponents

class LightButton: MDCButton {

  override func draw(_ rect: CGRect) {
    MDCButtonColorThemer.applySemanticColorScheme(Theme.lightColorScheme(), to: self)
    inkColor = Color.brandLightColor
  }

}

Upvotes: 2

Views: 452

Answers (0)

Related Questions