You can theme a button bar with your app's typography scheme using the TypographyThemer extension. ToButtonBar : buttonBar ] Typography Theming Id colorScheme = init ] // Step 3: Apply the color scheme to your component [ MDCButtonBarColorThemer applySemanticColorScheme : colorScheme applySemanticColorScheme ( colorScheme, to : buttonBar ) Objective-C // Step 1: Import the ColorThemer extension #import "MaterialButtonBar+ColorThemer.h" // Step 2: Create or get a color scheme MaterialButtonBar_ColorThemer // Step 2: Create or get a color scheme let colorScheme = MDCSemanticColorScheme () // Step 3: Apply the color scheme to your component MDCButtonBarColorThemer. You must first add the Color Themer extension to your project: pod 'MaterialComponents/ButtonBar+ColorThemer' Swift // Step 1: Import the ColorThemer extension import MaterialComponents. You can theme a button bar with your app's color scheme using the ColorThemer extension. Note: in order to make Button Bar reflect changes to not-observed properties you must clear the MDCButtonBar instance's items property and reset it, like so: Swift actionItem. TODO(featherless): File bugs to observe the rest of the properties. The following properties are taken into consideration when items is set and the corresponding buttons are created.Ĭhanges made to properties marked (observed) will be reflected in the corresponding buttons. height ) Supported UIBarButtonItem properties items = actionItem ] CGSize size = CGPoint origin = CGPointZero īuttonBar. Style : UIBarButtonItemStyleDone // ignoredīuttonBar. addSubview ( buttonBar ) Objective-C MDCButtonBar * buttonBar = init ] UIBarButtonItem * actionItem = initWithTitle "" frame = CGRect ( x :, y:, width: size.width, height: size.height) self. MaterialButtonBar Objective-C #import "MaterialButtonBar.h" Usage Typical use Swift let buttonBar = MDCButtonBar () let actionItem = UIBarButtonItem (īuttonBar. To import the component: Swift import MaterialComponents. Then, run the following command: pod install Installation Installation with CocoaPodsĪdd the following to your Podfile: pod 'MaterialComponents/ButtonBar' Learn more by reading the section on UIBarButtonItem properties. Button Bars are slightly more versatile in that one might use a Button Bar to create a Toolbar or a Navigation Bar (left/right button bars).īutton Bar supports a subset of UIBarButtonItem's properties. Design & API documentation Related components Table of contentsĪ Button Bar is similar in concept to a UIToolbar, but Button Bars are not a drop-in API replacement for UIToolbar. The Button Bar is a view that represents a list of UIBarButtonItems as horizontally aligned buttons.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |