root / Classes / PingIPAddressViewController.m @ 700184fb
History | View | Annotate | Download (2.5 kB)
1 |
// |
---|---|
2 |
// PingIPAddressViewController.m |
3 |
// OpenStack |
4 |
// |
5 |
// Created by Mike Mayo on 4/23/10. |
6 |
// The OpenStack project is provided under the Apache 2.0 license. |
7 |
// |
8 |
|
9 |
#import "PingIPAddressViewController.h" |
10 |
#import "ServerViewController.h" |
11 |
#import "OpenStackAppDelegate.h" |
12 |
|
13 |
@implementation PingIPAddressViewController |
14 |
|
15 |
@synthesize webView, serverViewController; |
16 |
|
17 |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { |
18 |
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) || (toInterfaceOrientation == UIInterfaceOrientationPortrait); |
19 |
} |
20 |
|
21 |
- (void)loadPingSite { |
22 |
NSString *urlString = [NSString stringWithFormat:@"http://just-ping.com/index.php?vh=%@&s=ping", ipAddress]; |
23 |
NSURL *url = [NSURL URLWithString:urlString]; |
24 |
[webView loadRequest:[NSURLRequest requestWithURL:url]]; |
25 |
} |
26 |
|
27 |
- (void)cancelButtonPressed:(id)sender { |
28 |
[self dismissModalViewControllerAnimated:YES]; |
29 |
// [serverViewController.tableView deselectRowAtIndexPath:serverViewController.selectedIPAddressIndexPath animated:YES]; |
30 |
} |
31 |
|
32 |
- (void)refreshButtonPressed:(id)sender { |
33 |
[self loadPingSite]; |
34 |
} |
35 |
|
36 |
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. |
37 |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil ipAddress:(NSString *)anIPAddress { |
38 |
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { |
39 |
// Custom initialization |
40 |
ipAddress = anIPAddress; |
41 |
} |
42 |
return self; |
43 |
} |
44 |
|
45 |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. |
46 |
- (void)viewDidLoad { |
47 |
[super viewDidLoad]; |
48 |
[self loadPingSite]; |
49 |
|
50 |
OpenStackAppDelegate *app = [[UIApplication sharedApplication] delegate]; |
51 |
navigationBar.tintColor = app.navigationController.navigationBar.tintColor; |
52 |
navigationBar.translucent = app.navigationController.navigationBar.translucent; |
53 |
navigationBar.opaque = app.navigationController.navigationBar.opaque; |
54 |
navigationBar.barStyle = app.navigationController.navigationBar.barStyle; |
55 |
} |
56 |
|
57 |
- (void)didReceiveMemoryWarning { |
58 |
// Releases the view if it doesn't have a superview. |
59 |
[super didReceiveMemoryWarning]; |
60 |
|
61 |
// Release any cached data, images, etc that aren't in use. |
62 |
} |
63 |
|
64 |
|
65 |
- (void)viewDidUnload { |
66 |
[super viewDidUnload]; |
67 |
// Release any retained subviews of the main view. |
68 |
// e.g. self.myOutlet = nil; |
69 |
} |
70 |
|
71 |
|
72 |
- (void)dealloc { |
73 |
[webView release]; |
74 |
[super dealloc]; |
75 |
} |
76 |
|
77 |
|
78 |
@end |