Eventually found a solution. In the view's constructor:
UIWindow window = UIApplication.SharedApplication.KeyWindow;
UIView view = window.Subviews[0];
view.RemoveFromSuperview();
window.AddSubview(view);
And provided the view has this:
public override bool ShouldAutorotateToInterfaceOrientation
(UIInterfaceOrientation toInterfaceOrientation)
{
return toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft
|| toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight;
}
It will force rotation as expected, and then you just have to handle the
WillRotate and move your controls (if designed in Portrait layout). I found
another solution that used transformations, but it didn't rotate the
NavigationBar - this actually seems to trick the phone into thinking it's
rotated - even the simulator rotates when it loads.
Dino
-----Original Message-----
From: Dimitris Tavlikos [mailto:[email protected]]
Sent: Thursday, March 15, 2012 2:26 PM
To: Dean Cleaver
Cc: [email protected]
Subject: Re: [MonoTouch] Specifying Orientation
It can be done, but it is a bit difficult.
You will have to apply rotations to the view.
Dimitris Tavlikos
Software Developer
Author of "iOS Development using MonoTouch Cookbook"
Email: [email protected]
Twitter: http://twitter.com/#!/dtavlikos
Blog: http://software.tavlikos.com
On 15 Mar 2012, at 9:20 PM, Dean Cleaver wrote:
> Hi,
>
> From what I can find on the net, you "can't" specify the orientation of a
> view in an iPhone App - but watching the PayPal payments demo, they appear to
> do exactly that.
>
> https://www.paypal.com/webapps/mpp/credit-card-reader
>
> Any ideas how to achieve it?
>
> Dino
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch