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 methodshouldAutorotateToInterfaceOrientation
to return yes whenever you want the autorotation to be performed. It's all in theMPMoviePlayerViewController
class reference.– Zelldweller
精彩评论