簡體   English   中英

將MPMoviePlayerController旋轉到橫向 - iPhone SDK

[英]Rotate MPMoviePlayerController to Landscape - iPhone SDK

我試圖將我的MPMoviePlayerController旋轉到橫向視圖,但它始終保持縱向模式。 我在UIViewController中這樣做,當我處於全屏模式時,我仍然無法旋轉我的MPMoviePlayerController。 我是否必須對shouldAutorotatetoOrientation方法做些什么? 如果有人知道怎么做,請回復!

謝謝,

凱文

UIViewController類引用

默認情況下,UIViewController類僅以縱向模式顯示視圖。 要支持其他方向,必須覆蓋shouldAutorotateToInterfaceOrientation:方法,並為子類支持的任何方向返回YES。 如果正確配置了視圖的自動調整屬性,則可能只需要執行此操作。 但是,UIViewController類為您提供了額外的鈎子,以根據需要實現其他行為。

例如,如果您的autoresizingMask設置為UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight ,你的電影播放器視圖的父視圖具有autoresizesSubviews = YES ,然后從返回YES shouldAutorotateToInterfaceOrientation可能是所有你需要做的。

我發現這種方式只是有用但是時間設置所需的框架 -

theMovie=[[MPMoviePlayerController alloc] initWithContentURL:theURL]; 
// Rotate the view for landscape playback   
[[theMovie view] setBounds:CGRectMake(-230, 155, 480, 350)];
[[theMovie view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM