Ios 如何旋转添加到窗口的子视图?

Ios 如何旋转添加到窗口的子视图?,ios,objective-c,cocoa-touch,Ios,Objective C,Cocoa Touch,我有一个UITabBarController子类,在那里我必须编写以下代码: -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; }

我有一个
UITabBarController
子类,在那里我必须编写以下代码:

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
} 
工作非常好,当我翻转设备时会有一个旋转。我的问题是,在我的应用程序的某些部分,我希望在所有东西上都有一个层,比如登录屏幕等等,所以我使用以下方法:

LoginView *loginView = [[LoginView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame delegate:self];
[[UIApplication sharedApplication].keyWindow addSubview:loginView]; //<-- Won't rotate

//[self.view addSubview:loginView]; <-- will rotate but will not be on top of everything (tabbar etc')
LoginView*LoginView=[[LoginView alloc]initWithFrame:[UIScreen mainScreen]。应用程序框架委托:self];

[[UIApplication sharedApplication].keyWindow添加子视图:loginView]//阅读Apple HIG.。您使用模式演示来实现此目的…您是否尝试将登录视图的边界设置为当前视图的边界?边界包括旋转等变换。主窗口的方向没有改变。@MarcusAdams我没有改变。分享心得如何做到这一点?