Well, the first part you have taken care of, and that's telling IOS yes or no
to supporting a given orientation.

After that, well, it gets a bit complicated.  You have to compare the
desired orientation to the current device orientation and then force an
orientation switch via:
UIApplication.SharedApplication.SetStatusBarOrientation()

I've found that I actually have to remove and then re-push the view
controller as well to get everything to work properly, which is a pain
because that means that each view controller must be "aware" of the "push"
vs. "repush" condition.  The repush was needed to get the navigation bar and
view orientation to change in relation to the status bar orientation change.

Additionally, if the device orientation is - let's say portrait - and you
want to force an orientation change to landscape (where the view will
literally be in landscape, with the device in portrait) then you must apply
a 90 degree transform to the view as well.  Applying the transform requires
that you also trap rotation changes.  Once the device rotates to landscape
(in this example, which matches the landscape-only controller) then the
transform needs to be removed.

Because of all of the above, some "systemic" solution really will help in
the long run - it can be on a page by page basis, but once you factor in
transitions from each page, that could be in different orientations, and the
potential ne4ed to force an orientation change in relation to current device
orientation, it can get real messy real quick.

Orientation management in IOS is not trivial unfortunately.  conceptually we
should be able to think that if a view controller that supports portrait
only transitions to a view that supports landscape only, then IOS would do
the rest - it does not.

I can help you out with a skeleton of all the pieces that you would need to
include to really get a functional system going where different controllers
support different orientations, with auto rotation working.  that will
require a bit of back and forth, so email would probably be better.  

I originally did a per-view-controller approach for this, but very very
quickly found that the ensuing chaos was not worth it, a single point of
management (at the root view controller) is a far better solution than
re-creating the significant amount of logic for each view, then handling
transitions in the WillAppear sections and such.



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

Reply via email to