My iPhone app is a portrait orientation only app and in my app I have a UITableView
that has a UIWebView
in the first UITableCell
. The UIWebView
shows an embedded youtube video. When I click on the video to play it enters fullscreen mode. What I need to do is, allow the user to rotate their device and play the video in landscape mode. Then when the video is stopped only allow portrait again. I setup to listen for the notification when the video enters fullscreen and leaves full screen. But I don't know how to programmatically allow the user to rotate the interface orientation.
so basically I have 2 methods called when the notification is passed
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeFinished:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];
-(void)youTubeStarted:(NSNotification *)notification{
// Entered fullscreen code goes here.
}
-(void)youTubeFinished:(NSNotification *)notification{
// Left fullscreen code goes here.
}
What would I put in those 2 methods to allow orientation change only during the video playback?