material-components_materia.../components/Dialogs/examples/DialogsTypicalUseViewController.m
Alastair Tse 4a46c8c19e Monochromatic sweep of all catalog components (#1370)
* 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
2017-05-05 16:16:47 -04:00

89 lines
3.2 KiB
Objective-C

/*
Copyright 2016-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.
*/
#import "DialogsTypicalUseSupplemental.h"
#import "MaterialButtons.h"
#import "MaterialDialogs.h"
@interface DialogsTypicalUseViewController ()
@property(nonatomic, strong) MDCDialogTransitionController *transitionController;
@end
@implementation DialogsTypicalUseViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self loadCollectionView:@[@"Programmatic", @"Storyboard", @"Modal"]];
// We must create and store a strong reference to the transitionController.
// A presented view controller will set this object as its transitioning delegate.
self.transitionController = [[MDCDialogTransitionController alloc] init];
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
if (indexPath.row == 0) {
[self didTapProgrammatic:nil];
} else if (indexPath.row == 1) {
[self didTapStoryboard:nil];
} else if (indexPath.row == 2) {
[self didTapModalProgrammatic:nil];
}
}
- (IBAction)didTapProgrammatic:(id)sender {
UIViewController *viewController =
[[ProgrammaticViewController alloc] initWithNibName:nil bundle:nil];
viewController.modalPresentationStyle = UIModalPresentationCustom;
viewController.transitioningDelegate = self.transitionController;
[self presentViewController:viewController animated:YES completion:NULL];
}
- (IBAction)didTapModalProgrammatic:(id)sender {
UIViewController *viewController =
[[ProgrammaticViewController alloc] initWithNibName:nil bundle:nil];
viewController.modalPresentationStyle = UIModalPresentationCustom;
viewController.transitioningDelegate = self.transitionController;
[self presentViewController:viewController animated:YES completion:NULL];
MDCDialogPresentationController *presentationController =
viewController.mdc_dialogPresentationController;
if (presentationController) {
presentationController.dismissOnBackgroundTap = NO;
}
}
- (IBAction)didTapStoryboard:(id)sender {
// If you are using this code outside of the MDCCatalog in your own app, your bundle may be nil.
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
UIStoryboard *storyboard =
[UIStoryboard storyboardWithName:@"DialogWithPreferredContentSize" bundle:bundle];
NSString *identifier = @"DialogID";
UIViewController *viewController =
[storyboard instantiateViewControllerWithIdentifier:identifier];
viewController.modalPresentationStyle = UIModalPresentationCustom;
viewController.transitioningDelegate = self.transitionController;
[self presentViewController:viewController animated:YES completion:NULL];
}
@end