To reproduce:
1. Build and run the Dragons catalog app.
2. Launch the Tabs -> Text Tabs example.
3. Change alignment to "Selected Center".
4. Tap "Select First"
5. Tap "Select Last"
6. Tap "Select First" again
7. Tap "Select Last" again
Expected:
The selected (last) tab has both the selection indicator beneath it and highlighted text (white with 100% alpha)
Actual:
The selected (last) tab has the selection indicator beneath it, but its text styled as though it is not selected.
PiperOrigin-RevId: 306568811
This PR un-reverts #7518 and makes it so that the delegate methods introduced in #7518 are only called if the items are nonnull.
#7555 should be merged in first.
Closes#6275.
One of the solutions proposed in #6275 is to provide pass through methods for the UICollectionViewDelegate methods `-collectionView:willDisplayCell:forItemAtIndexPath:` and `-collectionView:didEndDisplayingCell:forItemAtIndexPath:`. This is the one I chose, mainly because it seemed the most straightforward. [One comment](https://github.com/material-components/material-components-ios/issues/6275#issuecomment-453650714) said we should be careful about this approach, and [another](https://github.com/material-components/material-components-ios/issues/6275#issuecomment-454204635) said we needed to look more into the "pre-fetching" behavior of these methods. It seems like a good approach to me... Scrolling through the tabs in the TabBarTextOnlyExample with print statements seems to work how I would expect it to. 👍
{MDC iOS} No longer using `-init` for Color Scheme.
Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.
Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.
This was an automated change generated by running a find-and-replace regular expression:
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
Made colorScheme and typographyScheme properties in the class interfaces for all our examples.
Moved theming away from example inits and into viewDidLoad
Small update for slider example to allow it to grab the theming properly.
Related Pivotal: https://www.pivotaltracker.com/story/show/156616695
Discussed merge with Ian offline. Issues with Travis CI may be resolved once the PR is merged.
* Add color to tiles.
* Add theming to catalog
* Update text field tile.
* Implementation method signatures should match those in header.
* Update MDCDrawFunc typedef
* Pass color scheme through NSNotification
* Add component theming
* Add tabbar themer
* Update tab example to use UIAppearance
* Theme sliders based on UIAppearance proxy
* Allow any class conforming to MDCColorScheme
* Override navigation bar color theme for imagery example.
* Update AppBar and ButtonBar color theming
* Update button bar themer comment
* Update button theming
* Remove theme imports where not necessary.
* Fix case of private
* Replace MDC all icons
* Update border
* Replace MDCActionExtension icon with new logo
* Update all headers to be white on black
* Make Catalog greyscale to match Material’s style.
* Fix collection tile
* Update all headers to be white on black
* Make Catalog greyscale to match Material’s style.
* Fix collection tile
* WIP: Updating TabBar example to use black/green theme.
* WIP: Monochoroming all examples.
* Switch MDC Catalog to a black and white theme (#1355)
* Replace MDC all icons
* Update border
* Replace MDCActionExtension icon with new logo
* Update all headers to be white on black
* Make Catalog greyscale to match Material’s style.
* Fix collection tile
* Update all headers to be white on black
* Make Catalog greyscale to match Material’s style.
* Fix collection tile
* Fix floats
* Make Catalog greyscale to match Material’s style.
* More black and whiting
* WIP: Snackbar and global style
* Simplify snack bar examples.
* Page control
* Initial implementation of MDCTabBar and private MDCItemBar (#711)
* Add initial headers for MDC*Bar
* Initial chunk of work
* It works…ish
* Update demo images and update style with appearance
* Update Podfile.lock
* Merge
* Merge
* Revert bottom bar for now
* Update description
* Formatting and cleanup
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Update with consistent terminology
* Update constant names
* Update localizable strings
* More naming updates
* Rename TabBar to Tabs, move ItemBar into Tabs/private
* Rename string keys
* Rename string files from ItemBar to Tabs
* Rename string keys header
* Update podspec and move bundle
* Reset Podfile.lock in preparation for re-updating
* Clean update to Podfile.lock, adding MaterialTabs
* Update import paths
* Move CatalogByConvention method to end of file
* Add copyright notice on all h/m files
* Add safe fallbacks for switches
* Use conventional common init method name
* Podfile.lock checksum update
* [Tabs] Initial README template and changes
* [Tabs] Updating intro content.
* [Tabs] Commenting out mention of bottom navigation bars in readme.
* Initial implementation of MDCTabBar and private MDCItemBar (#711)
* Add initial headers for MDC*Bar
* Initial chunk of work
* It works…ish
* Update demo images and update style with appearance
* Update Podfile.lock
* Merge
* Merge
* Revert bottom bar for now
* Update description
* Formatting and cleanup
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Update with consistent terminology
* Update constant names
* Update localizable strings
* More naming updates
* Rename TabBar to Tabs, move ItemBar into Tabs/private
* Rename string keys
* Rename string files from ItemBar to Tabs
* Rename string keys header
* Update podspec and move bundle
* Reset Podfile.lock in preparation for re-updating
* Clean update to Podfile.lock, adding MaterialTabs
* Update import paths
* Move CatalogByConvention method to end of file
* Add copyright notice on all h/m files
* Add safe fallbacks for switches
* Use conventional common init method name
* Podfile.lock checksum update
* [Tabs] Initial README template and changes
* [Tabs] Updating intro content.
* [Tabs] Commenting out mention of bottom navigation bars in readme.
* [Tabs] Correcting resources key in pod spec.
* [Tabs] Correcting implementation of resources key in pod spec.
* [Tabs] Removing duplicate entry in pod spec (cherry pick artifact.)
* [Tabs] Overview written
* [Tabs] Mentioning badges in overview.
* [Tabs] Removing TODO in ready.
* [Tabs] Duplicating tabs example in prep for splitting it into two.
* [Tabs] Examples crudely split apart.
* [Pods] Update of lock, catalog and tests for new version.
* [Tabs] Refactored examples to be in style of supplemented examples.
* [Tabs] Formatting.
* [Tabs] Formatting.
* [Tabs] Formatting.
* Add usage examples
* Add usage examples
* Fix bad merge
* Update import documentation
* Small edits
* Do not show badges for title-only tabs
Also updates the text-only example to toggle upcasing rather than increment non-existent badges.
* Update title-only documentation re: badges
* Update README.md
* Update Podfile.lock
* Manually fix Podfile.lock
* Feature tabs rebase from develop (#7)
* [Docs] Add hero image to top-level README.md (#1100)
* Added hero image.
* Added retina-sized hero image.
* Add `srcset` image tag.
* Flow image to the right.
* Update README.md
* Fixed srcset, duh.
* Update README.md
* Update README.md
* Gave up on srcset+markdown for now.
* Update README.md
* Update README.md
* Increased image size.
* Remove redundant RTL frame adjustment (#1103)
* Made build/test scripts exit with failure if anything failed. (#1088)
* [ReadMes] - First image of each component is too big (#1110)
* MDC_#917 - Activity Indicator Readme Update
* MDC_#917 - Updated remaining readme image links
* MDC_#917 - Fixed typo
* [Site] Removing unused files for and from generated doc site. (#1108)
* [ReadMes] - Updated asset name for collection_cells (#1111)
* Enable Travis CI integration (#1095)
* Add file to kick off Travis
* Checking Travis CI's installed Xcode and simulator devices.
* Adding Cocoapods init to Travis CI config.
* Enabling building in Travis CI config.
* Added temporary dumping of the log file on error.
* Switched Shrine to manual signing.
* Dump Travis code signing options.
* Adding CocoaPods version to debug output.
* Remove code signing reporting from Travis CI config.
* Forcing `build_all` to skip code signing.
* Switching Shrine back to automatic provisioning style.
* Re-enabling testing in Travis CI.
* Bump up verbosity of testing.
* Changing test device from 10.2 to 10.1 to work around Travis CI bug.
* Remove the printing of available devices, Xcode will print them out on error.
* Added more context on failure for Travis CI builds only.
* Re-enable CI for our normal branches.
* Remove "do not merge" file.
* Removing our development team and switching Catalog to automatic profiles.
* Removing our development team and switching Bare to automatic profiles.
* Removing our development team and switching Pesto to automatic profiles.
* Add Travis CI build badge to README.md (#1112)
* Add uploading of testing code coverage results to codecov.io (#1114)
This won't do anything yet, but once we start emitting code coverage files it will.
* Enable test code coverage reports in Xcode and in Travis CI. (#1115)
* Add codecov.io badge to README.md. (#1116)
* Add Codecov config to exclude uninteresting paths. (#1118)
* Extracts header code into method removing repetition (#1119)
* [AppBar] Header stack view in AppBarController (#1121)
Since the header stack view is going to be laid out with auto layout, it should be inited with a CGRectZero. Doing it with self.view.bounds creates a tiny loop since the view is not loaded yet.
* Initial implementation of MDCTabBar and private MDCItemBar (#711)
* Add initial headers for MDC*Bar
* Initial chunk of work
* It works…ish
* Update demo images and update style with appearance
* Update Podfile.lock
* Merge
* Merge
* Revert bottom bar for now
* Update description
* Formatting and cleanup
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Update with consistent terminology
* Update constant names
* Update localizable strings
* More naming updates
* Rename TabBar to Tabs, move ItemBar into Tabs/private
* Rename string keys
* Rename string files from ItemBar to Tabs
* Rename string keys header
* Update podspec and move bundle
* Reset Podfile.lock in preparation for re-updating
* Clean update to Podfile.lock, adding MaterialTabs
* Update import paths
* Move CatalogByConvention method to end of file
* Add copyright notice on all h/m files
* Add safe fallbacks for switches
* Use conventional common init method name
* Podfile.lock checksum update
* Initial implementation of MDCTabBar and private MDCItemBar (#711)
* Add initial headers for MDC*Bar
* Initial chunk of work
* It works…ish
* Update demo images and update style with appearance
* Update Podfile.lock
* Merge
* Merge
* Revert bottom bar for now
* Update description
* Formatting and cleanup
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Manual revert of mistaken changes
* Update with consistent terminology
* Update constant names
* Update localizable strings
* More naming updates
* Rename TabBar to Tabs, move ItemBar into Tabs/private
* Rename string keys
* Rename string files from ItemBar to Tabs
* Rename string keys header
* Update podspec and move bundle
* Reset Podfile.lock in preparation for re-updating
* Clean update to Podfile.lock, adding MaterialTabs
* Update import paths
* Move CatalogByConvention method to end of file
* Add copyright notice on all h/m files
* Add safe fallbacks for switches
* Use conventional common init method name
* Podfile.lock checksum update
* [Tabs] Initial README template and changes
* [Tabs] Updating intro content.
* [Tabs] Commenting out mention of bottom navigation bars in readme.
* [Tabs] Overview written
* [Tabs] Correcting resources key in pod spec.
* [Tabs] Correcting implementation of resources key in pod spec.
* [Tabs] Mentioning badges in overview.
* [Tabs] Removing TODO in ready.
* [Tabs] Removing duplicate entry in pod spec (cherry pick artifact.)
* [Tabs] Duplicating tabs example in prep for splitting it into two.
* [Tabs] Examples crudely split apart.
* [Pods] Update of lock, catalog and tests for new version.
* [Tabs] Refactored examples to be in style of supplemented examples.
* [Tabs] Formatting.
* [Tabs] Formatting.
* [Tabs] Formatting.
* Add usage examples
* Add usage examples
* Update import documentation
* Small edits
* Do not show badges for title-only tabs
Also updates the text-only example to toggle upcasing rather than increment non-existent badges.
* Update title-only documentation re: badges
* Update README.md
* Update Podfile.lock
* Manually fix Podfile.lock
* [Tabs] Making delegate methods all optional. (#8)
* [Tabs] Now that protocol has optional methods, putting in safety for the method calls. (#9)
* [Tabs] Small changes for UIAppearance support.
* [Tabs] Formatting examples.
* [Tabs] Changed icon example to be an appBar’s bottomBar.
* [Tabs] Styling of examples.
* [Tabs] Example layout correction.
* [Tabs] Example update.
* [Tabs] Example has more ‘content’.
* [Tabs] Removing unused delegate method in example.
* [Tabs] Formatting of code for style.
* [Tabs] Better unselected style choice in icon example.
* [Tabs] More content in example vies.
* [Tabs] iOS 8 support for icons example.
* [Tabs] Still image.
* [Tabs] Video added.
* [Tabs] Renaming for clarity.
* [Tabs] Correcting comment.
* [Tabs] Better organization of example view creation methods.
* [Tabs] Cleaning up imports in example.
* [Tabs] Better code for incrementing badge in example.
* [Tabs] Using local variable vs @property in example
* [Tabs] Example format correction.
* [Tabs] Alphabetizing lists in examples.
* [Tabs] Example code style improvement.
* [Tab] Example NSAssert. Safety.
* [Tabs] Comments and clarity in example.
* [Tabs] clang-format in examples.
* [Tabs] Text color correction in example.
* [Tabs] Catalog tile.
* [Tabs] clang-format in tile.
* [Tabs] Adding IBOutlet for delegate (optional.)
* [Tabs] Fix 32-bit build
* [Tabs] Interface Builder example.
* [Tabs] Beginning Swift example.
* [Tabs] More swift example content.
* [Tabs] Swift example complete
* [Tabs] Swift example PR note implementations.
* [Tabs] Swift formatting
* [Tabs] Formatting in example
* [Tabs] Formatting swift example.
* [Tabs] Swift example clarity.
* [Tabs] Example wrapping revert.
* [Tabs] Example wrapping revert.
* Fixes from review