GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coding-iOS/Coding_iOS/Controllers/EALocalCodeViewController.m at master · coding/Coding-iOS Expand file tree/ Copy pathEALocalCodeViewController.mMore file actions 93 lines (81 loc) · 3.15 KB / Copy pathEALocalCodeViewController.mFile metadata and controls93 lines (81 loc) · 3.15 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 // // EALocalCodeViewController.m // Coding_iOS // // Created by Easeeeeeeeee on 2018/3/28. // Copyright © 2018年 Coding. All rights reserved. // #import "EALocalCodeViewController.h" #import "WebContentManager.h" @interface EALocalCodeViewController ()<UIWebViewDelegate> @property (strong, nonatomic) UIWebView *webContentView; @property (strong, nonatomic) UIActivityIndicatorView *activityIndicator; @end @implementation EALocalCodeViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title = _curURL.lastPathComponent; {//用webView显示内容 _webContentView = [[UIWebView alloc] initWithFrame:self.view.bounds]; _webContentView.delegate = self; _webContentView.backgroundColor = [UIColor clearColor]; _webContentView.opaque = NO; _webContentView.scalesPageToFit = YES; [self.view addSubview:_webContentView]; //webview加载指示 _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleGray]; _activityIndicator.hidesWhenStopped = YES; [_activityIndicator setCenter:CGPointMake(CGRectGetWidth(_webContentView.frame)/2, CGRectGetHeight(_webContentView.frame)/2)]; [_webContentView addSubview:_activityIndicator]; [_webContentView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.view); }]; } [self loadData]; } - (void)loadData{ if ([_curURL isTextData]) { CodeFile *file = [CodeFile codeFileWithLocalURL:_curURL]; NSString *codeStr = [WebContentManager codePatternedWithContent:file isEdit:NO]; [self.webContentView loadHTMLString:codeStr baseURL:nil]; }else{ [self.webContentView loadRequest:[NSURLRequest requestWithURL:_curURL]]; } } #pragma mark - Orientations - (BOOL)shouldAutorotate { return YES; } - (UIInterfaceOrientationMask)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAllButUpsideDown; } #pragma mark UIWebViewDelegate - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ DebugLog(@"strLink=[%@]",request.URL.absoluteString); UIViewController *vc = [BaseViewController analyseVCFromLinkStr:request.URL.absoluteString]; if (vc) { [self.navigationController pushViewController:vc animated:YES]; return NO; } return YES; } - (void)webViewDidStartLoad:(UIWebView *)webView{ [_activityIndicator startAnimating]; } - (void)webViewDidFinishLoad:(UIWebView *)webView{ [_activityIndicator stopAnimating]; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ [_activityIndicator stopAnimating]; if (error.code == NSURLErrorCancelled) { NSLog(@"Canceled request: %@", webView.request.URL); }else if ([error.domain isEqualToString:@"WebKitErrorDomain"] && (error.code == 102 || error.code == 204)) { NSLog(@"ignore: %@", error); }else { [NSObject showError:error]; } } @end |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |