You can theme an MDCButton to match a Material Design button style using theming extensions. Learn more about theming extensions.
First, import both Buttons and Buttons Theming and create an instance of MDCButton.
import MaterialComponents.MaterialButtons import MaterialComponents.MaterialButtons_Theming let button = MDCButton()
#import <MaterialComponents/MaterialButtons.h> #import <MaterialComponentsBeta/MaterialButtons+Theming.h> MDCButton *button = [[MDCButton alloc] init];
You can then provide a container scheme instance to any of the MDCButton theming extensions. Learn more about container schemes.
Material text button theming:
button.applyTextTheme(withScheme: containerScheme)
[self.button applyTextThemeWithScheme:self.containerScheme];
Material outlined button theming:
button.applyOutlinedTheme(withScheme: containerScheme)
[self.button applyOutlinedThemeWithScheme:self.containerScheme];
Material contained button theming:
button.applyContainedTheme(withScheme: containerScheme)
[self.button applyContainedThemeWithScheme:self.containerScheme];
First, create a button and import the theming extension header for Buttons.
import MaterialComponents.MaterialButtons import MaterialComponentsBeta.MaterialButtons_Theming let floatingButton = MDCFloatingButton()
#import <MaterialComponents/MaterialButtons.h> #import <MaterialComponentsBeta/MaterialButtons+Theming.h> MDCFloatingButton *floatingButton = [[MDCFloatingButton alloc] init];
Material floating action button theming:
floatingButton.applySecondaryTheme(withScheme: containerScheme)
[self.floatingButton applySecondaryThemeWithScheme: self.containerScheme];