0

我有一个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')

在这种情况下,登录屏幕将不会旋转。我怎样才能拥有一个覆盖所有内容的子视图,并且仍然像所有其他视图一样强制它旋转?

4

0 回答 0