FreeRDP
Loading...
Searching...
No Matches
HelpController.m
1/*
2 Application help controller
3
4 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
5
6 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 If a copy of the MPL was not distributed with this file, You can obtain one at
8 http://mozilla.org/MPL/2.0/.
9 */
10
11#import "HelpController.h"
12#import "Utils.h"
13
14@implementation HelpController
15
16- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
17{
18 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
19 if (self)
20 {
21 // set title and tab-bar image
22 [self setTitle:NSLocalizedString(@"Help", @"Help Controller title")];
23 UIImage *tabBarIcon = [UIImage
24 imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tabbar_icon_help"
25 ofType:@"png"]];
26 [self setTabBarItem:[[[UITabBarItem alloc]
27 initWithTitle:NSLocalizedString(@"Help", @"Tabbar item help")
28 image:tabBarIcon
29 tag:0] autorelease]];
30 }
31 return self;
32}
33
34// Implement loadView to create a view hierarchy programmatically, without using a nib.
35- (void)loadView
36{
37 webView = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease];
38 [webView
39 setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
40 [webView setAutoresizesSubviews:YES];
41 [webView setDelegate:self];
42 [webView setDataDetectorTypes:UIDataDetectorTypeNone];
43 [self setView:webView];
44}
45
46- (void)dealloc
47{
48 [super dealloc];
49}
50
51// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
52- (void)viewDidLoad
53{
54 [super viewDidLoad];
55
56 NSString *filename = (IsPhone() ? @"gestures_phone" : @"gestures");
57 NSString *htmlString = [[[NSString alloc]
58 initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:filename
59 ofType:@"html"
60 inDirectory:@"help_page"]
61 encoding:NSUTF8StringEncoding
62 error:nil] autorelease];
63
64 [webView
65 loadHTMLString:htmlString
66 baseURL:[NSURL fileURLWithPath:[[[NSBundle mainBundle] bundlePath]
67 stringByAppendingPathComponent:@"help_page"]]];
68}
69
70// Override to allow orientations other than the default portrait orientation.
71- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
72{
73 return YES;
74}
75
76@end