请帮忙,我在 UIWebView 中有一个 PDF,它向右移动,切断了边框和一些内容。将设备置于横向,然后打开包含 webview/pdf 的页面会导致这种情况发生。这发生在设备和模拟器中。这是代码。
#import "waterTwoViewController.h"
@interface waterTwoViewController ()
@end
@implementation waterTwoViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
double screenWidth = [UIScreen mainScreen].bounds.size.width;
double screenHeight = [UIScreen mainScreen].bounds.size.height;
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth,
screenHeight)];
webView.scalesPageToFit=YES;
webView.contentMode = UIViewContentModeScaleToFill;
webView.multipleTouchEnabled = YES;
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
[self.view addSubview:webView];
NSString *path = [[NSBundle mainBundle] pathForResource:@"WaterLineSizingValues"
ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end