简体   繁体   English

UIWebView不会与多个选项卡应用程序一起旋转

[英]UIWebView doesn't rotate with multiple tabs application

I am using UIWebView to display the PDF and Word documents on iPhone. 我正在使用UIWebView在iPhone上显示PDF和Word文档。 I want them to auto rotate when device orientation changes. 我希望它们在设备方向更改时自动旋转。 For that I have added following delegate method. 为此,我添加了以下委托方法。 Something weird is happening though. 虽然发生了一些奇怪的事情。 It works fine when I have I have only one tab which has UIWebView. 当我只有一个具有UIWebView的选项卡时,它可以正常工作。 It loads document fine and also rotate perfectly but when I add another tab, it doesn't rotate..! 它可以很好地加载文档,并且可以完美旋转,但是当我添加另一个标签时,它不会旋转..! While debugging I could see that when I have two table, it receives the rotation event only for UIDeviceOrientationLandscapeRight and UIDeviceOrientationLandscapeLeft. 调试时,我看到有两个表时,它仅接收UIDeviceOrientationLandscapeRight和UIDeviceOrientationLandscapeLeft的旋转事件。 Could any one please help me to get rid of this. 谁能帮我摆脱这个问题。

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; -(BOOL)应该AutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {return YES;

} }

Thanks. 谢谢。

Assuming you're using a tab bar controller for the tabs, you need to make sure that the views on all tabs support the different device orientations. 假设您对选项卡使用选项卡栏控制器,则需要确保所有选项卡上的视图均支持不同的设备方向。 Try implementing the methods in the tab bar controller class. 尝试实现选项卡栏控制器类中的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM