MonoTouch UI Orientation

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MonoTouch UI Orientation

mobiledev1600
My app needs orientation set to portrait as well as landscape mode except one screen. On one view i only want to set it to portrait. I have following code but it is not working for portrait mode on that screen

In AppDelegate

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations (UIApplication application, UIWindow forWindow)
    {
        return UIInterfaceOrientationMask.All;
    }

In ViewController

public override bool ShouldAutorotate()
    {
        return true;
    }

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
    {
        return UIInterfaceOrientationMask.Portrait;
    }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

Nic Wise
shouldn't this:

public override bool ShouldAutorotate()
    {
        return true;
    }

return false?

Your topmost VC doesn't rotate.... it's fixed in Portrait?

This makes for good reading tho :)

http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html



On 17 June 2013 20:22, mobiledev1600 <[hidden email]> wrote:

> My app needs orientation set to portrait as well as landscape mode except one
> screen. On one view i only want to set it to portrait. I have following code
> but it is not working for portrait mode on that screen
>
> *In AppDelegate*
>
> public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations
> (UIApplication application, UIWindow forWindow)
>     {
>         return UIInterfaceOrientationMask.All;
>     }
>
> *In ViewController*
>
> public override bool ShouldAutorotate()
>     {
>         return true;
>     }
>
> public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations
> ()
>     {
>         return UIInterfaceOrientationMask.Portrait;
>     }
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/MonoTouch-UI-Orientation-tp4658349.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

mobiledev1600
Basically i have two tabs in my app. One tab i want portrait mode only and second tab portrait and landscape both.
In my app delegate

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations
 (UIApplication application, UIWindow forWindow)
     {
         return UIInterfaceOrientationMask.All;
     }


In first tab view where i want portrait only

public override bool ShouldAutorotate()
    {
         return false;
     }
 
 public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations
 ()
     {
         return UIInterfaceOrientationMask.Portrait;
     }

still it doesn't work. When i rotate view on first tab it rotates to landscape mode.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

Robert Jordan
On 18.06.2013 16:47, mobiledev1600 wrote:
> Basically i have two tabs in my app. One tab i want portrait mode only and
> second tab portrait and landscape both.


See
http://stackoverflow.com/questions/6100309/rotate-one-uiviewcontroller-in-uitabbar-application

Robert

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

mobiledev1600
I guess it is for a model view only. How to transform it in the MonoTouch. The code i posted make sense but doesn't work that way. very strange!!!!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

Nic Wise
it's the top most ViewController which controls it, so when you switch
tabs, you could return a different value?

Not sure how you'd force it to rotate if it was in landscape and you
wanted it to go back, but it should stop it being rotated.

On 18 June 2013 16:10, mobiledev1600 <[hidden email]> wrote:

> I guess it is for a model view only. How to transform it in the MonoTouch.
> The code i posted make sense but doesn't work that way. very strange!!!!
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/MonoTouch-UI-Orientation-tp4658349p4658356.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

mobiledev1600
Thats true with MonoTouch. Whatever is in the top most controller applies to other controllers. In my root view controller it is
return UIInterfaceOrientationMask.All;

It then applies to other controllers so i can;t change it  for one tab bar view to make it portrait only.
Hope to find a better solution........
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MonoTouch UI Orientation

mobiledev1600
I am still struggling to make it work. Any suggestion???
Loading...