开发者

Why can't I retrieve UIDeviceOrientation correctly while playing a movie in MPMoviePlayerController?

开发者 https://www.devze.com 2023-01-02 08:05 出处:网络
Everything works fine while I\'m not playing anything (I\'m calling beginnotifications, etc, and using the orientation to rotate my view). But after I start playing with MPMoviePlayerController everyt

Everything works fine while I'm not playing anything (I'm calling beginnotifications, etc, and using the orientation to rotate my view). But after I start playing with MPMoviePlayerController everytime when I try

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

The orientation gets a UIDeviceOrientationUnknown.

Any clue? When the movie stops everything works alright again. I need this orientation to rotate the player's window, because开发者_运维技巧 Im using Iphone OS 3.1 so I can't directly use the view property inside MPMovie player controller.


I haven't found a way to do this at least in iPhone OS version lower than 3.2. I gave up.

But hey, I had to code a version for my app in the Ipad and I discovered that for iPhone OS 3.2, there's a way to do it.

The only thing you have to do is to use a custom class, that you have to make child of MPMoviePlayerViewController and override the method shouldAutorotateToInterfaceOrientation to return yes whenever you want the autorotation to be performed. It's all in the MPMoviePlayerViewController class reference.

– Zelldweller

0

精彩评论

暂无评论...
验证码 换一张
取 消