Forcing UIImagePickerController to shoot video in landscape mode


I've got a mostly-portrait iPhone application that needs to shoot some video, and I'd like to gently encourage (okay, force) users to shoot that video in landscape mode.

I've tried creating a UIViewController with ShouldAutorotateToInterfaceOrientation overridden to return false, and appropriate CGAffineTransforms on its view, but it has no effect -- I assume because the view is out of the picture once you call PresentModalViewController to display the UIImagePickerController. The controls always show up in the same place, and the switch-to-front-camera control still moves around when I rotate the phone.

Any suggestions? I'd settle for definitive evidence that this isn't possible, though I'm not sure my boss would.


Try calling UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications() in your AppDelegate.

Then in the ViewDidLoad() method of your UIImagePickerController, add an observer by doing the following:

public override void ViewDidLoad()
    NSNotificationCenter.DefaultCenter.AddObserver("UIDeviceOrientationDidChangeNotification", DeviceRotated);

where DeviceRotated is

private void DeviceRotated(NSNotification notification)
    button.Transform = CGAffineTransform.MakeRotation(1.5f);
By : leonardo

This video can help you solving your question :)
By: admin