-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHelpViewController.m
More file actions
91 lines (73 loc) · 2.22 KB
/
HelpViewController.m
File metadata and controls
91 lines (73 loc) · 2.22 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
//
// HelpViewController.m
//
// Created by Jiva DeVoe on 5/10/09.
// Copyright 2009 Random Ideas, LLC. All rights reserved.
//
#import "HelpViewController.h"
#import "UIView+Positioning.h"
@interface HelpViewController ()
@property (strong, nonatomic) NSURL *helpURL;
@end
@implementation HelpViewController
-(id)initWithHelpFileURL:(NSString *)inWebUrl;
{
return [self initWithHelpURL:[NSURL URLWithString:inWebUrl]];
}
-(id)initWithHelpURL:(NSURL *)inWebUrl;
{
if((self = [super initWithNibName:@"HelpView" bundle:nil]))
{
[self setHelpURL:inWebUrl];
}
return self;
}
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleDefault;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
{
return YES;
}
-(IBAction)doneTouched:(id)sender;
{
[self.delegate viewControllerFinishedModalAction:self];
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
[[self.navBar topItem] setTitle:@"Loading..."];
[self.spinner startAnimating];
[self.button setHidden:NO];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
if(self.appTitle)
[[self.navBar topItem] setTitle:self.appTitle];
else
[[self.navBar topItem] setTitle:@"Help"];
[self.spinner stopAnimating];
[self.button setHidden:YES];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
- (void)viewDidLoad
{
[self.webView loadRequest:[NSURLRequest requestWithURL:self.helpURL]];
[[self.navBar topItem] setTitle:@"Loading..."];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
if(UIDeviceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
self.spinner.center = CGPointMake(512, 384);
else
self.spinner.center = [[UIApplication sharedApplication] keyWindow].center;
}
else
self.spinner.center = [[UIApplication sharedApplication] keyWindow].center;
[self.spinner startAnimating];
[super viewDidLoad];
}
@end