IOS7 UIWebView不旋转

时间:2013-10-04 00:30:11

标签: uiwebview ios7

我有简单的UIWebView应用加载html,问题是当我旋转设备时UIWebView不会旋转。

这是ViewController.m

#import "WrapperViewController.h"

@implementation WrapperViewController

- (void) viewDidLoad
{
    NSBundle *bundle   = [NSBundle mainBundle]; 
    NSString *path     = [bundle bundlePath];
    NSString *fullPath = [NSBundle pathForResource:@"index"
                         ofType:@"htm" inDirectory:path];

    [webView loadRequest:[NSURLRequest requestWithURL:
                         [NSURL fileURLWithPath:fullPath]]];

}

- (BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{

    return YES;
}

-(BOOL)shouldAutorotate{
    return YES;
}


- (void) didRotateFromInterfaceOrientation:
  (UIInterfaceOrientation)fromInterfaceOrientation
{
   webView.scalesPageToFit = YES;
   webView.backgroundColor = [UIColor blackColor];

}

- (void) didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (void) dealloc
{
    [super dealloc];
}

@end

0 个答案:

没有答案