This will keep the primary action and menu properties of the UIBarButtonItem and apply them to the button.
If no primary action is set, the menu will be used as primary action automatically.
PiperOrigin-RevId: 321320327
By default, UIPointerStyle uses the target view's frame for a highlight effect. Providing view.bounds caused the highlight effect to use a zero-origin frame.
PiperOrigin-RevId: 304177779
Prior to this change, it was possible to implicitly downcast item views to UIButton or MDCButton, potentially causing crashes by treating custom views incorrectly as a button and invoking UIButton selectors on it.
This change removes the `__kindof` implicit casting for the _buttonViews ivar so that the buttonViews need to be explicitly casted to a button type.
Related to https://github.com/material-components/material-components-ios/issues/9760
When a bar button item with a custom view is provided to the button bar, the custom view is used in place of an MDCButton instance. 6ec9f334f0e093e1d2bf04165895ca725455150e introduced a change that unconditionally called a UIButton API on the views when the tintColor was changed, resulting in a crash when a custom view was used.
This change adds a test that, prior to this fix in this change, crashed, but after the fix included in this change now passes.
Upon inspection of the culprit code, it was revealed that image and title similarly could result in crashes, so those crashes have been fixed as part of this change as well.
Closes https://github.com/material-components/material-components-ios/issues/9760
Prior to this change, UIBarButtonItem's tintColor property would not change the title color of the corresponding button. This differs from the UIKit behavior, which does result in the title color being changed.
After this change, changing a UIBarButtonItem's tintColor will result in the corresponding button's title color being updated as well.
PiperOrigin-RevId: 293848033
Resolves the following error:
"Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior"
PiperOrigin-RevId: 293801599
Prior to this change, UIBarButtonItem's tintColor property would not change the title color of the corresponding button. This differs from the UIKit behavior, which does result in the title color being changed.
After this change, changing a UIBarButtonItem's tintColor will result in the corresponding button's title color being updated as well.
PiperOrigin-RevId: 293583337
The title color logic was previously being applied in three different places in slightly different ways each time. This change consolidates the logic into a single method and invokes this new method from each place where the title color can change; namely:
1. When initially creating the button.
2. When the button's tintColor context changes.
3. When the button item's tintColor property changes.
PiperOrigin-RevId: 293580183
The `titleFontForState:` API did not correctly reflect the rendered font
when no explicit fonts were set via the MDCButton APIs. As a result,
calling `updateTitleFont` internally could result in a different font
being returned than what was displayed.
Moving the "fall back" and Dynamic Type behavior into the
`titleFontForState:` method allows more consistent behavior (reduces the
risk of deviations) and corrects the APIs to reflect what is rendered.
This change should result in no visible changes to clients (the rendered
fonts should remain the same), but will result in non-`nil` results
being returned from `titleFontForState:` to correctly reflect the
rendered font for a given state.
Part of #7492
This API will allow clients to present overlay views that point to views in an MDCButtonBar.
Expected usage:
```swift
@objc func didTapButton(_ item: UIBarButtonItem) {
let rect = buttonBar.rect(for: item, in: view)
// Present an overlay pointing at `rect`
}
```
Closes https://github.com/material-components/material-components-ios/issues/7248
We need to add @objc annotations to colorScheme and typographyScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find `setColorScheme:` and `setTypographyScheme:` setters otherwise.
This PR graduates ContainerScheme to ready.
This includes updating the podspecs, podfile, all the import statements related to ContainerScheme, updating .kokoro rewrite rules, and finally the readme to not have ContainerScheme regarded to as being in beta.
Ran locally kokoro with -b bazel successfully.
Resolves#6732