我在 ipad xib 中有一个 webview,在两个方向 w 上都可以正常工作。但是如果我在纵向模式下放大,然后在横向 webview 中旋转从右侧获取边距
- (void)viewDidLoad
{
NSString *urlString=@"http://www.plus.al";
NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
webView.scalesPageToFit = YES;
[webView loadRequest:request];
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
if (UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
webView.frame=CGRectMake(0, 0, 1024, 748);
}
if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
webView.frame=CGRectMake(0, 0, 768, 1004);
}
else {
if (UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
webView.frame=CGRectMake(0, 0, 480, 300);
}
if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
webView.frame=CGRectMake(0, 0, 320, 460);
}
}
return YES;
}
请帮助我。在此先感谢。