我以为我已经问过这个问题,但我看不到它,所以我会再问一次。
我需要编写一个只包含一个旋转的 web 视图的应用程序。当用户将手机从纵向变为横向或反之时,如何旋转文本?
干杯
保罗
这是自动处理的。在您的视图控制器中,覆盖该方法:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
return YES;
}
并确保您的 webview 的自动调整大小掩码设置如下:
webView.autoResizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
您是否使用 UIViewController 控制 UIWebView?如果是这样,覆盖
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation