12 Commits

Author SHA1 Message Date
Robert Moore
4842c32fd8
[Tabs] Fixes layout for changing font sizes. (#7771)
When different font sizes for different states are used, the item view may end up with a different layout or even a different intrinsic content size.

Follow-up to #7757
2019-07-02 09:49:55 -04:00
Robert Moore
febf914e97
[Tabs] Adds support for rendering custom views. (#7755)
Clients can provide their own custom views if MDCTabBarView doesn't provide
sufficient behavior by default. An example custom view (containing a UISwitch)
is added to the Dragons example and a test.

![Simulator Screen Shot - iPhone 7 - 2019-06-28 at 22 49 36](https://user-images.githubusercontent.com/1753199/60379003-26e59f80-99f9-11e9-8d68-49d775c7b3c8.png)


Closes #7722
2019-07-01 08:59:37 -04:00
Cody Weaver
029692a0ba [TabBarView] Add titleFontForState APIs (#7757)
Adds `titleFont:forState:` APIs to customize the font of selected and unselected items generally. A future change may enable support for `-[UIBarItem titleTextAttributesForState:]`.

## Dragons Example View Controller

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone 7 - 2019-06-30 at 22 38 45](https://user-images.githubusercontent.com/1753199/60407218-e9634c80-9b87-11e9-9bef-10c2449002a7.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-30 at 22 39 36](https://user-images.githubusercontent.com/1753199/60407236-f718d200-9b87-11e9-8380-195235c9494e.png)|


Part of #7657
2019-07-01 01:13:34 -04:00
mikefan1991
c3fe63e5e2 [Tabs] Add accessibility traits support (#7739)
Add UIAccessibility traits to item view.

**Testing**
accessibilityTraits
Steps to reproduce

1. Update the example to have a custom accessibilityTraits for one of the tabBarItems
    1. Optionally have it change those traits in the `tabBarView:didSelectItem:` delegate method.
2. item1.accessibilityTraits = @"Hello world";
3. Launch on a device
4. Select the item with Voiceover on
5. Navigate to the other items with titles but no custom value.
2019-06-28 00:45:34 -04:00
mikefan1991
ca5afce441 [Tabs] Add the user selection visible logic (#7740)
Add the logic that the selected item will be visible once on screen.
If the selected item is changed when the tab bar view is displayed, the scroll process is animated.
If the selected item is set before the tab bar view is displayed, the scroll process is not animated.

![tabs-selection-scroll](https://user-images.githubusercontent.com/1753199/60311093-abfe8500-9923-11e9-9654-a8e4bda2a6a2.gif)


Part of #7728
2019-06-28 00:44:52 -04:00
mikefan1991
46c8e51ae3 [Tabs] Add delegate support to MDCTabBarView (#7725)
This PR is adding the delegate support for the MDCTabBarView. Two delegate methods shoudSelect and didSelect is defined.

close #7658
2019-06-27 13:00:55 -04:00
Ang
60d5f0dbef [Tabs] Adds justified and scrollable layout to MDCTabBarView (#7704)
Adds justified and scrollable layout for MDCTabBarView and corresponding tests.

## Example View Controller

|Before|After (Portrait)|After (Landscape)
|---|---|---|
|![60151483-ea246900-97aa-11e9-9c1e-688f1d241512](https://user-images.githubusercontent.com/1753199/60179832-920e5680-97ec-11e9-8131-ebcf17f853de.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-26 at 08 27 47](https://user-images.githubusercontent.com/1753199/60179840-98043780-97ec-11e9-9d3a-cbcfd48cb202.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-26 at 08 29 09](https://user-images.githubusercontent.com/1753199/60179813-815de080-97ec-11e9-9d7b-14e19fae4df1.png)|


Part of Issue #7645
2019-06-26 11:13:30 -04:00
Robert Moore
88e145c62b
[Tabs] Add imageTintColorForState APIs. (#7714)
Adds an image tint color for the `.normal` and `.selected` states.

## Example View Controller

The intrinsic content size is known to be incorrect for bars where items have both titles and images. It will be fixed as part of https://github.com/material-components/material-components-ios/pull/7704.

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone 7 - 2019-06-24 at 13 20 57](https://user-images.githubusercontent.com/1753199/60151475-e7297880-97aa-11e9-8fc1-205b44011d5f.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-26 at 00 37 13](https://user-images.githubusercontent.com/1753199/60151483-ea246900-97aa-11e9-9c1e-688f1d241512.png)|

Part of #7657
2019-06-26 08:09:38 -04:00
mikefan1991
e243456b42 [Tabs] Add user selection support to the MDCTabBarView (#7713)
Adds basic tap support to items in the tab bar.

## TabBarView Example View Controller

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone 7 - 2019-06-24 at 13 20 57](https://user-images.githubusercontent.com/1753199/60150317-2d300d80-97a6-11e9-8d9c-025b28888427.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-26 at 00 04 09](https://user-images.githubusercontent.com/1753199/60150319-315c2b00-97a6-11e9-90d8-9c8348dcd0de.png)|

Part of #7644
2019-06-26 00:40:53 -04:00
Robert Moore
41369ecc17
[Tabs] Add barTintColor API. (#7711)
Adding a `barTintColor` to match APIs on MDCBottomNavigationBar, MDCBottomAppBar, MDCTabBar, and UITabBar.

Part of #7657
2019-06-25 15:37:35 -04:00
Robert Moore
d202640cd3
[Tabs] Send tab item title/image to views (#7698)
Initial configuration of title and image for itemviews. Does not yet have KVO (coming later). Is using a temporary layout that will be replaced later.

##  Dragon Example Screenshots

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone 7 - 2019-06-24 at 13 23 15](https://user-images.githubusercontent.com/1753199/60038806-3d030100-9683-11e9-9121-9daa78134e1b.png)|![Simulator Screen Shot - iPhone 7 - 2019-06-24 at 13 20 57](https://user-images.githubusercontent.com/1753199/60038676-fb725600-9682-11e9-83e5-3f0dd7a7669c.png)|


Part of #7697
2019-06-24 13:53:46 -04:00
Robert Moore
d0f3843388
[Tabs] Add missing example. (#7671)
The example was moved but I failed to add it to git from its new location.

Follow-up to #7655
2019-06-21 10:54:30 -04:00