0

我的视图层次结构如下所示:

标签栏 -> 导航栏 -> 表格视图 -> 视图 1 -> 视图 2 (UIWebView)

如何旋转视图 2 使其可以在横向和纵向模式下显示?

4

1 回答 1

4

继承人你的修复......刚刚解决了同样的问题。问题是标签栏控制器对 shouldRotate 方法没有响应。

忽略苹果文档中的建议并为选项卡视图控制器创建一个子类。在该子类中处理 shouldRotate

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // 始终返回 YES 意味着视图将旋转以适应任何方向。返回是;}

这是我的完整子类 TSTabBarController.h

#import <Foundation/Foundation.h>
@interface TSTabBarController : UITabBarController {

}

@end

和实现文件。

#import "TSTabBarController.h"


@implementation TSTabBarController
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Always returning YES means the view will rotate to accomodate any orientation.
    return YES;
}


@end

如果您在 IB 中更改标签栏控制器的类,您应该可以工作。

希望这可以帮助。
富有的

于 2010-03-10T19:21:31.600 回答