iOS外部显示器方向不正确

iOS外部显示器方向不正确,ios,objective-c,ipad,airplay,external-display,Ios,Objective C,Ipad,Airplay,External Display,我正在尽力将我的iPad应用程序屏幕镜像到外部显示器上。我知道,在选择苹果电视后,它只需使用AirPlay和Mirror就可以自动完成这项功能,然而,这种方法总是将其设置为信箱,并且不会占用整个屏幕。我只是想让它与iPad的内容一模一样,但却占据了整个苹果电视屏幕。在AppDelegate.h的代码中: #import <UIKit/UIKit.h> @class MainView; @class ViewController2; @interface AppDelegate : U

我正在尽力将我的iPad应用程序屏幕镜像到外部显示器上。我知道,在选择苹果电视后,它只需使用AirPlay和Mirror就可以自动完成这项功能,然而,这种方法总是将其设置为信箱,并且不会占用整个屏幕。我只是想让它与iPad的内容一模一样,但却占据了整个苹果电视屏幕。在AppDelegate.h的代码中:

#import <UIKit/UIKit.h>
@class MainView;
@class ViewController2;
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
    UIWindow *window;
    UINavigationController *tabBarController;
    ViewController2 *_remoteVC;

}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *tabBarController;
@property (strong, atomic) UIWindow *secondWindow;
@end
在项目的“常规设置”下,我只检查了方向。该应用程序仅限于iPad,使用MainWindow.xib,不使用故事板。所有ViewController都在MainWindow.xib中,没有一个类有自己的.xib文件。当我AirPlay或使用模拟器外部显示屏时,iPad和外部显示屏如下所示:
正如您所看到的,外部显示镜像似乎可以工作,因为它显示的颜色与导航栏的颜色相同,但可能方向不对?我不允许在任何视图控制器中自动旋转,也没有更改任何设置。我做错了什么?

我认为问题在于:

'_remoteVC = [[ViewController2 alloc] initWithNibName:nil bundle:nil];
    tabBarController = [[UINavigationController alloc] init];
    self.secondWindow.rootViewController = tabBarController;'
初始化导航视图控制器而不设置rootViewController。 您应该设置tabBarController.rootViewController=\u remoteVC

'_remoteVC = [[ViewController2 alloc] initWithNibName:nil bundle:nil];
    tabBarController = [[UINavigationController alloc] init];
    self.secondWindow.rootViewController = tabBarController;'