This is how I have done it:

public override void ViewDidLoad ()
{
        base.ViewDidLoad ();
                        
        UIWindow window = UIApplication.SharedApplication.KeyWindow;
        UIView view = window.Subviews[window.Subviews.Length - 1];
        view.RemoveFromSuperview();
        window.AddSubview(view);
}
                
public override bool ShouldAutorotateToInterfaceOrientation 
(UIInterfaceOrientation toInterfaceOrientation)
{
        return toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight  
;
}

The code in ViewDidLoad also needs to be called whenever that UIViewController 
is popped from the stack so that the orientation returns to normal.

Dino

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of devnl
Sent: Wednesday, September 12, 2012 09:35
To: [email protected]
Subject: [MonoTouch] Having 1 ViewController with different orientation

Hi,

I am currently building an application where every UIViewController only 
supports Portrait, except for one. This has to be LandscapeRight only and 
actually has to trigger that rotation as soon as it loads, without animations 
and other things. How and where would I trigger this rotation to happen without 
the user actually rotating his device or does anyone have a working sample I 
can take a look at?

Regards,

devnl



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Having-1-ViewController-with-different-orientation-tp4656971.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to