Chromium Code Reviews| 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/strip/sc_strip_coordinator.h" | |
| 6 | |
| 7 #import "ios/chrome/browser/ui/strip/strip_container_view_controller.h" | |
| 8 | |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 10 #error "This file requires ARC support." | |
| 11 #endif | |
| 12 | |
| 13 @interface SCStripCoordinator () | |
| 14 @property(nonatomic, strong) StripContainerViewController* viewController; | |
| 15 @end | |
| 16 | |
| 17 @implementation SCStripCoordinator | |
| 18 @synthesize baseViewController = _baseViewController; | |
| 19 @synthesize viewController = _viewController; | |
| 20 | |
| 21 - (void)start { | |
| 22 UIViewController* blackViewController = [[UIViewController alloc] init]; | |
| 23 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.
| |
| 24 UIViewController* greenViewController = | |
| 25 [self viewControllerWithButtonTitle:@"toggleStrip" | |
| 26 action:@selector(toggleTabStrip:)]; | |
| 27 greenViewController.view.backgroundColor = [UIColor greenColor]; | |
| 28 | |
| 29 self.viewController = [[StripContainerViewController alloc] init]; | |
| 30 self.viewController.title = @"Tab strip container"; | |
| 31 self.viewController.stripViewController = blackViewController; | |
| 32 self.viewController.contentViewController = greenViewController; | |
| 33 self.baseViewController.navigationBar.translucent = NO; | |
| 34 [self.baseViewController pushViewController:self.viewController animated:YES]; | |
| 35 } | |
| 36 | |
| 37 - (UIViewController*)viewControllerWithButtonTitle:(NSString*)title | |
| 38 action:(SEL)action { | |
| 39 UIViewController* viewController = [[UIViewController alloc] init]; | |
| 40 UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | |
| 41 [button setFrame:CGRectMake(10, 10, 80, 50)]; | |
| 42 [button setTitle:title forState:UIControlStateNormal]; | |
| 43 [viewController.view addSubview:button]; | |
| 44 [button addTarget:nil | |
| 45 action:action | |
| 46 forControlEvents:UIControlEventTouchUpInside]; | |
| 47 return viewController; | |
| 48 } | |
| 49 | |
| 50 @end | |
| OLD | NEW |