Blame client/iOS/Controllers/HelpController.m

Packit 1fb8d4
/*
Packit 1fb8d4
 Application help controller
Packit 1fb8d4
 
Packit 1fb8d4
 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
Packit 1fb8d4
 
Packit 1fb8d4
 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. 
Packit 1fb8d4
 If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#import "HelpController.h"
Packit 1fb8d4
#import "Utils.h"
Packit 1fb8d4
Packit 1fb8d4
@implementation HelpController
Packit 1fb8d4
Packit 1fb8d4
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
Packit 1fb8d4
{
Packit 1fb8d4
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
Packit 1fb8d4
    if (self) {
Packit 1fb8d4
		// set title and tab-bar image
Packit 1fb8d4
		[self setTitle:NSLocalizedString(@"Help", @"Help Controller title")];
Packit 1fb8d4
        UIImage* tabBarIcon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tabbar_icon_help" ofType:@"png"]];
Packit 1fb8d4
        [self setTabBarItem:[[[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"Help", @"Tabbar item help") image:tabBarIcon tag:0] autorelease]];
Packit 1fb8d4
    }
Packit 1fb8d4
    return self;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
// Implement loadView to create a view hierarchy programmatically, without using a nib.
Packit 1fb8d4
- (void)loadView 
Packit 1fb8d4
{
Packit 1fb8d4
	webView = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease];
Packit 1fb8d4
	[webView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
Packit 1fb8d4
	[webView setAutoresizesSubviews:YES];
Packit 1fb8d4
	[webView setDelegate:self];	
Packit 1fb8d4
	[webView setDataDetectorTypes:UIDataDetectorTypeNone];	
Packit 1fb8d4
	[self setView:webView];
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
- (void)dealloc {
Packit 1fb8d4
    [super dealloc];
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
Packit 1fb8d4
- (void)viewDidLoad 
Packit 1fb8d4
{
Packit 1fb8d4
    [super viewDidLoad];
Packit 1fb8d4
	
Packit 1fb8d4
    NSString *filename = (IsPhone() ? @"gestures_phone" : @"gestures");
Packit 1fb8d4
	NSString *htmlString = [[[NSString alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:filename ofType:@"html" inDirectory:@"help_page"]  encoding:NSUTF8StringEncoding error:nil] autorelease];
Packit 1fb8d4
	
Packit 1fb8d4
	[webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"help_page"]]];    
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
// Override to allow orientations other than the default portrait orientation.
Packit 1fb8d4
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
Packit 1fb8d4
    return YES;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
@end