Skip to content

Commit

Permalink
[Tabs] Inject dummy scroll view into example. (#7772)
Browse files Browse the repository at this point in the history
This change has no visible effect. It injects a scroll view into the TabBarView example view controller so that the injected AppBar won't manipulate the Tab Bar's insets.

Follow-up from #7744
  • Loading branch information
Robert Moore committed Jul 2, 2019
1 parent 4842c32 commit 5a7efb0
Showing 1 changed file with 15 additions and 0 deletions.
Expand Up @@ -74,6 +74,8 @@ - (void)viewDidLoad {
[super viewDidLoad];
self.title = kExampleTitle;

[self applyFixForInjectedAppBar];

if (!self.containerScheme) {
self.containerScheme = [[MDCContainerScheme alloc] init];
}
Expand Down Expand Up @@ -152,9 +154,22 @@ - (void)tabBarView:(MDCTabBarView *)tabBarView didSelectItem:(nonnull UITabBarIt
NSLog(@"Item (%@) was selected.", item.title);
}

#pragma mark - Errata

- (void)applyFixForInjectedAppBar {
// The injected AppBar has a bug where it will attempt to manipulate the Tab bar. To prevent
// that bug, we need to inject a scroll view into the view hierarchy before the tab bar. The App
// Bar will manipulate with that one instead.
UIScrollView *bugFixScrollView = [[UIScrollView alloc] init];
bugFixScrollView.userInteractionEnabled = NO;
bugFixScrollView.hidden = YES;
[self.view addSubview:bugFixScrollView];
}

@end

#pragma mark - CatalogByConvention

@implementation MDCTabBarViewTypicalExampleViewController (CatalogByConvention)

+ (NSDictionary *)catalogMetadata {
Expand Down

0 comments on commit 5a7efb0

Please sign in to comment.