diff options
author | Struan Donald <struan@exo.org.uk> | 2012-06-15 12:23:54 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-06-15 12:23:54 +0100 |
commit | cc1aa4a6676db38eabed168327941c6aa93b4654 (patch) | |
tree | a7848a02a53b88e89450de4fd187e7939fb61e80 /phonegap/iPhone/FixMyStreet/Classes/MainViewController.m | |
parent | 3a25a77b31e955ae6db9f7bd22120ef421aa5d92 (diff) | |
parent | d0c522739862671cc0ffa5cc1611d3772fe732bd (diff) |
Merge branch 'phonegap'
Diffstat (limited to 'phonegap/iPhone/FixMyStreet/Classes/MainViewController.m')
-rw-r--r-- | phonegap/iPhone/FixMyStreet/Classes/MainViewController.m | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/phonegap/iPhone/FixMyStreet/Classes/MainViewController.m b/phonegap/iPhone/FixMyStreet/Classes/MainViewController.m new file mode 100644 index 000000000..289da3596 --- /dev/null +++ b/phonegap/iPhone/FixMyStreet/Classes/MainViewController.m @@ -0,0 +1,140 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// MainViewController.h +// cordova1.8.0 +// +// Created by Struan Donald on 08/06/2012. +// Copyright __MyCompanyName__ 2012. All rights reserved. +// + +#import "MainViewController.h" + +@implementation MainViewController + +- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void) didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +#pragma mark - View lifecycle + +- (void) viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void) viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; +} + +/* Comment out the block below to over-ride */ +/* +- (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds +{ + return[super newCordovaViewWithFrame:bounds]; +} +*/ + +/* Comment out the block below to over-ride */ +/* +#pragma CDVCommandDelegate implementation + +- (id) getCommandInstance:(NSString*)className +{ + return [super getCommandInstance:className]; +} + +- (BOOL) execute:(CDVInvokedUrlCommand*)command +{ + return [super execute:command]; +} + +- (NSString*) pathForResource:(NSString*)resourcepath; +{ + return [super pathForResource:resourcepath]; +} + +- (void) registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className +{ + return [super registerPlugin:plugin withClassName:className]; +} +*/ + +#pragma UIWebDelegate implementation + +- (void) webViewDidFinishLoad:(UIWebView*) theWebView +{ + // only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle + if (self.invokeString) + { + // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready + NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString]; + [theWebView stringByEvaluatingJavaScriptFromString:jsString]; + } + + // Black base color for background matches the native apps + theWebView.backgroundColor = [UIColor blackColor]; + + return [super webViewDidFinishLoad:theWebView]; +} + +/* Comment out the block below to over-ride */ +/* + +- (void) webViewDidStartLoad:(UIWebView*)theWebView +{ + return [super webViewDidStartLoad:theWebView]; +} + +- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error +{ + return [super webView:theWebView didFailLoadWithError:error]; +} + +- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; +} +*/ + +@end |