| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/showcase/tab_strip/sc_tab_strip_coordinator.h" | |
| 6 | |
| 7 #import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" | |
| 8 #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_container_view_controll
er.h" | |
| 9 | |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 11 #error "This file requires ARC support." | |
| 12 #endif | |
| 13 | |
| 14 @interface SCTabStripCoordinator () | |
| 15 @property(nonatomic, strong) TabStripContainerViewController* viewController; | |
| 16 @end | |
| 17 | |
| 18 @implementation SCTabStripCoordinator | |
| 19 @synthesize baseViewController = _baseViewController; | |
| 20 @synthesize viewController = _viewController; | |
| 21 | |
| 22 - (void)start { | |
| 23 UIViewController* blackViewController = [[UIViewController alloc] init]; | |
| 24 blackViewController.view.backgroundColor = [UIColor blackColor]; | |
| 25 | |
| 26 UIViewController* greenViewController = | |
| 27 [self viewControllerWithButtonTitle:@"toggleStrip" | |
| 28 action:@selector(hideTabStrip:)]; | |
| 29 greenViewController.view.backgroundColor = [UIColor greenColor]; | |
| 30 | |
| 31 self.viewController = [[TabStripContainerViewController alloc] init]; | |
| 32 self.viewController.title = @"Tab strip container"; | |
| 33 self.viewController.tabStripViewController = blackViewController; | |
| 34 self.viewController.contentViewController = greenViewController; | |
| 35 self.baseViewController.navigationBar.translucent = NO; | |
| 36 [self.baseViewController pushViewController:self.viewController animated:YES]; | |
| 37 } | |
| 38 | |
| 39 - (UIViewController*)viewControllerWithButtonTitle:(NSString*)title | |
| 40 action:(SEL)action { | |
| 41 UIViewController* viewController = [[UIViewController alloc] init]; | |
| 42 UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | |
| 43 [button setFrame:CGRectMake(10, 10, 80, 50)]; | |
| 44 [button setTitle:title forState:UIControlStateNormal]; | |
| 45 [viewController.view addSubview:button]; | |
| 46 [button addTarget:nil | |
| 47 action:action | |
| 48 forControlEvents:UIControlEventTouchUpInside]; | |
| 49 return viewController; | |
| 50 } | |
| 51 | |
| 52 @end | |
| OLD | NEW |