UIWebView - 旋转导致非可伸缩区域

时间:2011-03-16 02:38:53

标签: iphone ios ipad uiwebview rotation

我对UIWebView有一个奇怪的问题。我必须通过旋转和调整大小来手动设置它的方向。但在我完成之后,网络内容的某些区域无法使用。

iPad是纵向的,但网页内容是使用横向构建的。所以我所做的是将容器旋转90度,设置容器的边界,并调整容器和网框的大小。

这是我用于此的代码:

 //rotate
 CGRect contentRect;
 CGAffineTransform transform;
 transform = CGAffineTransformMakeRotation(-3.14159/2);
 contentRect = CGRectMake(0,0,1024,768);

 //set container bounds and transform
 [_container setBounds:contentRect];
 [_container setTransform:transform];

 //set frame
 containerFrame = CGRectMake(0,0,768,1024);
 webViewFrame = CGRectMake(0,0,768,1024);
 [_webview setFrame:webViewFrame];
 [_container setFrame:containerFrame];

因此,在此旋转发生后,ipad仍处于纵向状态,网页内容在屏幕上正确显示(旋转)。但是低于768像素的内容无法互动。

我不确定发生了什么。这让我困扰了一段时间。有什么想法吗?

0 个答案:

没有答案
相关问题