-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathDemoCodeViewController.m
More file actions
56 lines (44 loc) · 1.41 KB
/
Copy pathDemoCodeViewController.m
File metadata and controls
56 lines (44 loc) · 1.41 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
//
// DemoCodeViewController.m
// StudyiOS
//
// Created by ZhangYiCheng on 12-12-7.
// Copyright (c) 2012年 ZhangYiCheng. All rights reserved.
//
#import "DemoCodeViewController.h"
@interface DemoCodeViewController ()
@end
@implementation DemoCodeViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.webView.delegate = self;
NSString *path = [[NSBundle mainBundle] pathForResource:self.uuid ofType:@"html"];
if (path) {
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath: path]]];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[self setWebView:nil];
[super viewDidUnload];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *requestURL = [request URL];
if (([[requestURL scheme] isEqualToString: @"http"] || [[requestURL scheme] isEqualToString:@"https"] || [[requestURL scheme] isEqualToString: @"mailto" ])
&& (navigationType == UIWebViewNavigationTypeLinkClicked)) {
return ![[UIApplication sharedApplication] openURL:requestURL];
}
return YES;
}
@end