Chromium Code Reviews| Index: ios/showcase/strip/sc_strip_coordinator.mm |
| diff --git a/ios/showcase/strip/sc_strip_coordinator.mm b/ios/showcase/strip/sc_strip_coordinator.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3eccbd33482b5bfa9ea7a2821fa0b2e42694ee5 |
| --- /dev/null |
| +++ b/ios/showcase/strip/sc_strip_coordinator.mm |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "ios/showcase/strip/sc_strip_coordinator.h" |
| + |
| +#import "ios/chrome/browser/ui/strip/strip_container_view_controller.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +@interface SCStripCoordinator () |
| +@property(nonatomic, strong) StripContainerViewController* viewController; |
| +@end |
| + |
| +@implementation SCStripCoordinator |
| +@synthesize baseViewController = _baseViewController; |
| +@synthesize viewController = _viewController; |
| + |
| +- (void)start { |
| + UIViewController* blackViewController = [[UIViewController alloc] init]; |
| + blackViewController.view.backgroundColor = [UIColor blackColor]; |
|
marq (ping after 24h)
2016/12/21 17:26:15
Newline after this to separate the two view contro
edchin
2016/12/22 10:37:44
Done.
|
| + UIViewController* greenViewController = |
| + [self viewControllerWithButtonTitle:@"toggleStrip" |
| + action:@selector(toggleTabStrip:)]; |
| + greenViewController.view.backgroundColor = [UIColor greenColor]; |
| + |
| + self.viewController = [[StripContainerViewController alloc] init]; |
| + self.viewController.title = @"Tab strip container"; |
| + self.viewController.stripViewController = blackViewController; |
| + self.viewController.contentViewController = greenViewController; |
| + self.baseViewController.navigationBar.translucent = NO; |
| + [self.baseViewController pushViewController:self.viewController animated:YES]; |
| +} |
| + |
| +- (UIViewController*)viewControllerWithButtonTitle:(NSString*)title |
| + action:(SEL)action { |
| + UIViewController* viewController = [[UIViewController alloc] init]; |
| + UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; |
| + [button setFrame:CGRectMake(10, 10, 80, 50)]; |
| + [button setTitle:title forState:UIControlStateNormal]; |
| + [viewController.view addSubview:button]; |
| + [button addTarget:nil |
| + action:action |
| + forControlEvents:UIControlEventTouchUpInside]; |
| + return viewController; |
| +} |
| + |
| +@end |