Skip to content

Commit

Permalink
[BottomSheet] Add an app bar to the typical use example. (#4268)
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed May 24, 2018
1 parent 790062b commit 0575212
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/BottomSheet/examples/BottomSheetTypicalUseExample.m
Expand Up @@ -16,6 +16,9 @@

#import <UIKit/UIKit.h>

#import "MaterialAppBar.h"
#import "MaterialAppBar+ColorThemer.h"
#import "MaterialAppBar+TypographyThemer.h"
#import "MaterialBottomSheet.h"
#import "supplemental/BottomSheetDummyCollectionViewController.h"
#import "supplemental/BottomSheetSupplemental.h"
Expand All @@ -25,10 +28,19 @@ @implementation BottomSheetTypicalUseExample
- (void)presentBottomSheet {
BottomSheetDummyCollectionViewController *viewController =
[[BottomSheetDummyCollectionViewController alloc] initWithNumItems:102];
viewController.preferredContentSize = CGSizeMake(500, 200);
viewController.title = @"Bottom sheet example";

MDCAppBarContainerViewController *container =
[[MDCAppBarContainerViewController alloc] initWithContentViewController:viewController];
container.preferredContentSize = CGSizeMake(500, 200);
container.appBar.headerViewController.headerView.trackingScrollView =
viewController.collectionView;

[MDCAppBarColorThemer applySemanticColorScheme:self.colorScheme toAppBar:container.appBar];
[MDCAppBarTypographyThemer applyTypographyScheme:self.typographyScheme toAppBar:container.appBar];

MDCBottomSheetController *bottomSheet =
[[MDCBottomSheetController alloc] initWithContentViewController:viewController];
[[MDCBottomSheetController alloc] initWithContentViewController:container];
bottomSheet.trackingScrollView = viewController.collectionView;
[self presentViewController:bottomSheet animated:YES completion:nil];
}
Expand Down
Expand Up @@ -16,8 +16,14 @@

#import <UIKit/UIKit.h>

#import "MaterialColorScheme.h"
#import "MaterialTypographyScheme.h"

@interface BottomSheetPresenterViewController : UIViewController

@property(nonatomic, strong) MDCSemanticColorScheme *colorScheme;
@property(nonatomic, strong) MDCTypographyScheme *typographyScheme;

- (void)presentBottomSheet;

@end
Expand Up @@ -22,6 +22,15 @@ @implementation BottomSheetPresenterViewController {
MDCButton *_button;
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
_colorScheme = [[MDCSemanticColorScheme alloc] init];
_typographyScheme = [[MDCTypographyScheme alloc] init];
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];

Expand Down

0 comments on commit 0575212

Please sign in to comment.