我試圖在使用AirPlay的外接顯示器上顯示全屏,16:9,UIViewController
。從橫向iPad啓動時,UIViewController在AirPlay屏幕上橫向顯示
這裏的目標是用自定義視圖控制器替換AirPlay鏡像,該控制器將跨越整個外部屏幕的大小。
當iPad處於縱向模式時,屏幕連接時,一切似乎都很好用。當它橫向連接時,UIViewController
在外部顯示器上橫向顯示,僅填滿屏幕的一半。
爲了達到此目的,我將UIViewController
添加到附加的AirPlay UIScreen
。
-(void) screenConnected:(NSNotification *) notification {
UIScreen * screen = [notification object]; //this should be the airplay display
UIWindow * window = [[UIWindow alloc] initWithFrame:screen.bounds];
[currentWindow setScreen:screen];
UIViewController * controller = [_delegate createControllerForAirplayDisplay:window];
[window setHidden:NO];
[window setRootViewController:controller];
}
這似乎工作正常,我看到在iPad上的全屏顯示以及AirPlay電視。
我在哪裏看到一個問題,就是在iPad處於橫向模式時AirPlay顯示器已連接。發生這種情況時,AirPlay顯示器會側身顯示UIViewController
,看起來像肖像模式。
屏幕連接肖像:
屏連接景觀,內容橫盤,只有一半呈現在顯示器上:
我已經嘗試旋轉使用UIWindow
和UIViewController
CGAffineTransformMakeRotation
,這會確定方向,但視圖不在AirPlay顯示內部。
編輯
提起與蘋果的問題與此相關,rdar:// 20817189。如果/當我聽到回聲,我會更新它。
有趣。升級到IOS 8.3後,我再次看到同樣的問題。現在我分享你的悲哀。你有沒有收到蘋果票上的回覆? – ganta
@gant仍然沒有在票上 – francis