我想在代碼中,讓我的視圖在iPad應用程序上鏡像到外部顯示器。在AppDelegate中didFinishLaunching,我有:鏡像視圖控制器到外部顯示器
if ([[UIScreen screens] count] > 1)
{
UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1];
NSString *availableModeString;
for (int i = 0; i < secondScreen.availableModes.count; i++)
{
availableModeString = [NSString stringWithFormat:@"%f, %f",
((UIScreenMode *)[secondScreen.availableModes objectAtIndex:i]).size.width,
((UIScreenMode *)[secondScreen.availableModes objectAtIndex:i]).size.height];
[[[UIAlertView alloc] initWithTitle:@"Available Mode" message:availableModeString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
availableModeString = nil;
}
// undocumented value 3 means no overscan compensation
secondScreen.overscanCompensation = 3;
self.secondWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 1280, 720)];
self.secondWindow.backgroundColor = [UIColor blueColor];
self.secondWindow.screen = secondScreen;
ViewController *viewController = [[ViewController alloc] init];
self.secondWindow.rootViewController = viewController;
self.secondWindow.hidden = NO;
}
所有,在外接顯示器顯示出來的是藍色的背景顏色在代碼中設置。
您是在談論使用視頻提供實時Feed還是僅僅在第二個屏幕上模仿視圖? 更重要的是,我們讓第二個屏幕使用觸摸來更改第一個屏幕嗎? – Ariel
大多數情況下,只是將iPad屏幕上的內容反映到Apple TV上,而不是在HD中執行此操作......沒有屏幕上的4個條形圖,當您僅從命令中心執行AirPlay鏡像時會發生這種情況。 – user717452