Blame client/iOS/Controllers/HelpController.m

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