I have one table tableviewController. On clicking one of the cell, the next viewController opens a cam and use AVCaptureVideoPreviewLayer to show video. To support orientations, I have added these lines of codes.
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
//return UIInterfaceOrientationMaskLandscapeRight;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] setVideoOrientation:
(AVCaptureVideoOrientation)toInterfaceOrientation];
}
But I want to lock my second view controller that shows video in landscape mode only. If the iPhone is in portrait mode, still I want that it will show only landscape mode. Like in some games, orientation is locked.