Ios6 从第一个视图(飞溅)到第一个viewController的旋转问题

Ios6 从第一个视图(飞溅)到第一个viewController的旋转问题,ios6,uiinterfaceorientation,uistoryboardsegue,screen-rotation,uiimageorientation,Ios6,Uiinterfaceorientation,Uistoryboardsegue,Screen Rotation,Uiimageorientation,我在Xcode 4.5.2中工作,使用故事板和segues将iOS6作为iPad应用程序的目标。 前言:我的根控制器(由应用程序代理加载)是一个启动屏幕,只有一个图像、一个升级按钮和一个打开按钮。应用程序需要几秒钟才能加载。我应该在所有三个全屏控制器中自动旋转并支持界面定向。对于旋转通知,我在根视图控制器中使用以下两种方法: - (void)awakeFromNib { [UIDevice.currentDevice beginGeneratingDeviceOrientationNot

我在Xcode 4.5.2中工作,使用故事板和segues将iOS6作为iPad应用程序的目标。 前言:我的根控制器(由应用程序代理加载)是一个启动屏幕,只有一个图像、一个升级按钮和一个打开按钮。应用程序需要几秒钟才能加载。我应该在所有三个全屏控制器中自动旋转并支持界面定向。对于旋转通知,我在根视图控制器中使用以下两种方法:

- (void)awakeFromNib
{
    [UIDevice.currentDevice beginGeneratingDeviceOrientationNotifications];
    [NSNotificationCenter.defaultCenter addObserver:self
                                       selector:@selector(orientationChanged:)
                                           name:UIDeviceOrientationDidChangeNotification
                                         object:nil];
}

- (void)orientationChanged:(NSNotification *)notification
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(deviceOrientation))
    {
        // Landscape
        CGRect rect = _libraryViewController.libraryTableBorder.frame;
        _libraryViewController.libraryTableBorder.frame = rect;
        _libraryViewController.libraryTableBorder.image = [UIImage imageNamed:@"LibraryBorder_L.png"];
    }
    else if (UIDeviceOrientationIsPortrait(deviceOrientation))
    {
        // Portrait
        CGRect rect = _libraryViewController.libraryTableBorder.frame;
        _libraryViewController.libraryTableBorder.frame = rect;
        _libraryViewController.libraryTableBorder.image = [UIImage imageNamed:@"LibraryBorder_P.png"];
    }
}
我在LibraryViewController中使用了这些非常相同的方法,它工作得非常好。我有另一个主视图控制器(entryView),它有相同的方法,不需要调用libraryTableBorder。无论设备从条目视图进入或进入条目视图的旋转是什么,表边框都会正确地交换出来。而且,当从库转到entryView或splash时,视图是正确的

问题是从景观中的飞溅视图到图书馆。去Potrait的图书馆工作很好,显示的边框是肖像边框。但是,在风景中,它也显示肖像边界。当库边框位于横向视图中时,如何从根视图获取库边框以在横向视图中显示


任何帮助解决这个难题的人都将不胜感激

我找到了解决这个问题的方法。。。ViewWillLayoutSubView

另一个线程提示我,它指向iOS6的发行说明。我添加了UIDeviceOrientation和if/else语句。现在,无论我去哪个视图或来自哪个视图,边框都会正确旋转

- (void)viewWillLayoutSubviews
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(deviceOrientation))
    {
        // Landscape
        CGRect rect = _libraryTableBorder.frame;
        _libraryTableBorder.frame = rect;
        _libraryTableBorder.image = [UIImage imageNamed:@"LibraryBorder_L.png"];
    }
    else if (UIDeviceOrientationIsPortrait(deviceOrientation))
    {
        // Portrait
        CGRect rect = _libraryTableBorder.frame;
        _libraryTableBorder.frame = rect;
        _libraryTableBorder.image = [UIImage imageNamed:@"LibraryBorder_P.png"];
    }
}
这对我来说确实是一个令人沮丧的问题。希望这对其他人有帮助