material-components-ios 发布版本: v55.4.0

This minor release includes better layout guide and safe area insets support to MDCAppBar's MDCAppBarContainerViewController, added customization to MDCNavigationBar title view layout, accessibility improvements and documentation.

New deprecations

MDCNavigationBar's property useFlexibleTopBottomInsets has been defaulted to YES and has now been deprecated. It will eventually be removed and become the default behavior.

New features

AppBar now allows its wrapped content view controllers to make proper use of the top layout guide and additional safe area insets APIs. This is done using the newly added property to AppBar's MDCAppBarContainerViewController named topLayoutGuideAdjustmentEnabled. An example on how to implement this behavior:

MDCAppBarContainerViewController *appBarContainerViewController;
UITableViewController *tableViewController =
    [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
appBarContainerViewController =
    [[MDCAppBarContainerViewController alloc] initWithContentViewController:tableViewController];
self.appBarContainerViewController.topLayoutGuideAdjustmentEnabled = YES;

NavigationBar now allows configuration of its title view layout behavior to be either "fill" or "center". The fill behavior is the default and existing behavior, which sets the title view's frame to fill the available navigation bar space. The center behavior will always attempt to center the title view within the navigation bar's bounds. The center behavior is desired by teams in the simple cases of when they want their title view to be centered within the navigation bar as best as possible. This is also the default behavior of UINavigationBar. Example usage:

MDCNavigationBar *navBar = [[MDCNavigationBar alloc] init];
navBar.titleView = [[UIView alloc] init];
navBar.titleViewLayoutBehavior = MDCNavigationBarTitleViewLayoutBehaviorCenter;

API changes

AppBar

MDCAppBarContainerViewController

new property: topLayoutGuideAdjustmentEnabled in MDCAppBarContainerViewController

NavigationBar

MDCNavigationBar

new property: titleViewLayoutBehavior in MDCNavigationBar

deprecated property: useFlexibleTopBottomInsets in MDCNavigationBar

Type of change: Deprecation message
From: useFlexibleTopBottomInsets
To: Implement proper vertical alignment with the default YES behavior.

new enum MDCNavigationBarTitleViewLayoutBehavior with values MDCNavigationBarTitleViewLayoutBehaviorFill and MDCNavigationBarTitleViewLayoutBehaviorCenter.

Component changes

AppBar

Changes

Buttons

Changes

TextFields

Changes

Snackbar

Changes

Slider

Changes

NavigationBar

Changes

BottomSheet

Changes

Typography

Changes

PageControl

Changes

Collections

Changes

HeaderStackView

Changes

FlexibleHeader

Changes