MainViewController.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. //
  18. // MainViewController.h
  19. // ionic-tabs
  20. //
  21. // Created by ___FULLUSERNAME___ on ___DATE___.
  22. // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
  23. //
  24. #import "MainViewController.h"
  25. @implementation MainViewController
  26. - (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil
  27. {
  28. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  29. if (self) {
  30. // Uncomment to override the CDVCommandDelegateImpl used
  31. // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
  32. // Uncomment to override the CDVCommandQueue used
  33. // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
  34. }
  35. return self;
  36. }
  37. - (id)init
  38. {
  39. self = [super init];
  40. if (self) {
  41. // Uncomment to override the CDVCommandDelegateImpl used
  42. // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
  43. // Uncomment to override the CDVCommandQueue used
  44. // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
  45. }
  46. return self;
  47. }
  48. - (void)didReceiveMemoryWarning
  49. {
  50. // Releases the view if it doesn't have a superview.
  51. [super didReceiveMemoryWarning];
  52. // Release any cached data, images, etc that aren't in use.
  53. }
  54. #pragma mark View lifecycle
  55. - (void)viewWillAppear:(BOOL)animated
  56. {
  57. // View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView),
  58. // you can do so here.
  59. [super viewWillAppear:animated];
  60. }
  61. - (void)viewDidLoad
  62. {
  63. [super viewDidLoad];
  64. // Do any additional setup after loading the view from its nib.
  65. }
  66. - (void)viewDidUnload
  67. {
  68. [super viewDidUnload];
  69. // Release any retained subviews of the main view.
  70. // e.g. self.myOutlet = nil;
  71. }
  72. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  73. {
  74. // Return YES for supported orientations
  75. return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
  76. }
  77. /* Comment out the block below to over-ride */
  78. /*
  79. - (UIWebView*) newCordovaViewWithFrame:(CGRect)bounds
  80. {
  81. return[super newCordovaViewWithFrame:bounds];
  82. }
  83. */
  84. #pragma mark UIWebDelegate implementation
  85. - (void)webViewDidFinishLoad:(UIWebView*)theWebView
  86. {
  87. // Black base color for background matches the native apps
  88. theWebView.backgroundColor = [UIColor blackColor];
  89. return [super webViewDidFinishLoad:theWebView];
  90. }
  91. /* Comment out the block below to over-ride */
  92. /*
  93. - (void) webViewDidStartLoad:(UIWebView*)theWebView
  94. {
  95. return [super webViewDidStartLoad:theWebView];
  96. }
  97. - (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
  98. {
  99. return [super webView:theWebView didFailLoadWithError:error];
  100. }
  101. - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
  102. {
  103. return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
  104. }
  105. */
  106. @end
  107. @implementation MainCommandDelegate
  108. /* To override the methods, uncomment the line in the init function(s)
  109. in MainViewController.m
  110. */
  111. #pragma mark CDVCommandDelegate implementation
  112. - (id)getCommandInstance:(NSString*)className
  113. {
  114. return [super getCommandInstance:className];
  115. }
  116. - (NSString*)pathForResource:(NSString*)resourcepath
  117. {
  118. return [super pathForResource:resourcepath];
  119. }
  120. @end
  121. @implementation MainCommandQueue
  122. /* To override, uncomment the line in the init function(s)
  123. in MainViewController.m
  124. */
  125. - (BOOL)execute:(CDVInvokedUrlCommand*)command
  126. {
  127. return [super execute:command];
  128. }
  129. @end