OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "cronet_sample_view_controller.h" |
| 6 |
| 7 #import "components/cronet/ios/Cronet.h" |
| 8 |
| 9 @implementation CronetSampleViewController { |
| 10 UIWebView* _webView; |
| 11 } |
| 12 |
| 13 - (void)viewDidLoad { |
| 14 self.view.backgroundColor = [UIColor whiteColor]; |
| 15 |
| 16 UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem]; |
| 17 [button setTitle:@"chromium.org" forState:UIControlStateNormal]; |
| 18 [button setFrame:CGRectMake(5, 0, 95, 50)]; |
| 19 [button addTarget:self |
| 20 action:@selector(loadChromium) |
| 21 forControlEvents:UIControlEventTouchUpInside]; |
| 22 [self.view addSubview:button]; |
| 23 |
| 24 _webView = [[UIWebView alloc] |
| 25 initWithFrame:CGRectMake(0, 52, self.view.bounds.size.width, |
| 26 self.view.bounds.size.height - 52)]; |
| 27 [self.view addSubview:_webView]; |
| 28 _webView.autoresizingMask = |
| 29 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
| 30 |
| 31 [self loadChromium]; |
| 32 } |
| 33 |
| 34 // Disable the status bar to sidestep all the iOS7 status bar issues. |
| 35 - (BOOL)prefersStatusBarHidden { |
| 36 return YES; |
| 37 } |
| 38 |
| 39 - (void)loadChromium { |
| 40 [_webView |
| 41 loadRequest:[NSURLRequest |
| 42 requestWithURL: |
| 43 [NSURL URLWithString:@"https://www.chromium.org"]]]; |
| 44 } |
| 45 |
| 46 @end |
OLD | NEW |