-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInfoViewController.m
More file actions
73 lines (54 loc) · 2.02 KB
/
Copy pathInfoViewController.m
File metadata and controls
73 lines (54 loc) · 2.02 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
//
// InfoViewController.m
// Innovation
//
// Created by Vladimir Pronin on 2/27/12.
// Copyright (c) 2012 YELELEO. All rights reserved.
//
#import "InfoViewController.h"
@interface InfoViewController()
@property (nonatomic, retain) NSURLRequest *request;
@end
@implementation InfoViewController
@synthesize request;
- (void)dealloc {
self.request = nil;
[webViewInfo release];
[super dealloc];
}
-(id)initWithURL:(NSURL *)url {
if (self = [super init]) {
self.request = [NSURLRequest requestWithURL:url];
}
return self;
}
-(void)viewDidLoad {
self.view.frame = CGRectMake(0, 0,[UIScreen mainScreen].bounds.size.width , [UIScreen mainScreen].bounds.size.height);
webViewInfo = [[UIWebView alloc] initWithFrame:CGRectMake(0, topBar.image.size.height,[UIScreen mainScreen].bounds.size.width , [UIScreen mainScreen].applicationFrame.size.height-self.navigationController.navigationBar.bounds.size.height)];
webViewInfo.delegate = self;
webViewInfo.scalesPageToFit = YES;
[webViewInfo loadRequest:self.request];
webViewInfo.backgroundColor = [UIColor grayColor];
[self.view addSubview:webViewInfo];
[self.navigationController setNavigationBarHidden:NO animated:YES];
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - WebView Delegate
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Sorry! There is no internet connection available!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
#pragma mark - View lifecycle
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end