Guest User

iOS Rotation Issues

a guest
Jan 16th, 2013
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import "NativeViewController.h"
  2.  
  3. @implementation NativeViewController
  4.  
  5. @synthesize webView;
  6.  
  7.  
  8. /*
  9. // The designated initializer. Override to perform setup that is required before the view is loaded.
  10. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  11.     if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
  12.         // Custom initialization
  13.     }
  14.     return self;
  15. }
  16. */
  17.  
  18. /*
  19. // Implement loadView to create a view hierarchy programmatically, without using a nib.
  20. - (void)loadView {
  21. }
  22. */
  23.  
  24.  
  25.  
  26.  
  27. -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  28.     if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
  29.         return YES;
  30.     }else{return YES;}
  31. }
  32.  
  33. -(BOOL)shouldAutorotate{return YES;};
  34.  
  35.  
  36. // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  37. - (void)viewDidLoad {
  38.     [super viewDidLoad];
  39.     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"login" ofType:@"html"];
  40.     NSData *htmlData = [NSData dataWithContentsOfFile:filePath];
  41.    
  42.    
  43.     if (htmlData) {
  44.         NSBundle *bundle = [NSBundle mainBundle];
  45.         NSString *path = [bundle bundlePath];
  46.         NSString *fullPath = [NSBundle pathForResource:@"login" ofType:@"html" inDirectory:path];
  47.         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]];
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment