You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Dmitry Blotsky <db...@microsoft.com> on 2016/01/07 06:38:14 UTC

How does orientation work, and what is shouldRotateToOrientation?

Hey folks,

I’ve had a bug forwarded my way where a Cordova app wouldn’t switch orientation on iOS unless the following code was present:

function onDeviceReady() {
    ...
    window.shouldRotateToOrientation = function (degrees) {
        return true;
    }
    ...
};

Could someone please explain why it is needed? Is this in one of our plugins? And perhaps also: what else/instead is needed to have a Cordova app properly support flipping of screen orientation?

Kindly,
Dmitry

Re: How does orientation work, and what is shouldRotateToOrientation?

Posted by julio cesar sanchez <jc...@gmail.com>.
I always thought that "default" on iOS was all but portrait upside down on
iPhones and all on iPads, as those are the orientations you get if you
create a new project from Xcode. But the doc you posted didn't tell that.



2016-01-08 18:55 GMT+01:00 Shazron <sh...@gmail.com>:

> There's an issue in JIRA to change the implication of 'default' in
> iOS. "Technically" what we are doing is "correct", but we're in the
> position to make things equal on all platforms. What do you all think?
>
> But then of course changing it now is a breaking change, so damned if
> you damned if you don't...
>
> On Fri, Jan 8, 2016 at 6:31 AM, Raymond Camden <ra...@gmail.com>
> wrote:
> > This bit me once too:
> >
> >
> http://www.raymondcamden.com/2015/11/09/cordova-ios-and-orientation-wondering-why-it-is-locked
> >
> > Definitely documented - but definitely not what I expected. ;)
> >
> > On Thu, Jan 7, 2016 at 3:22 PM, Shazron <sh...@gmail.com> wrote:
> >> What Julio said. The original intent for this was for a way for
> >> Cordova users to control orientation dynamically (say a view you have
> >> is supposed to work in landscape only) --  the orientation methods
> >> currently are all static (Info.plist based).
> >>
> >> On Wed, Jan 6, 2016 at 11:01 PM, julio cesar sanchez
> >> <jc...@gmail.com> wrote:
> >>> Can you share the whole bug report?
> >>>
> >>> On iOS the rotation doesn't work unless you configure it on the
> config.xml
> >>>
> >>>     <platform name="ios">
> >>>         <preference name="Orientation" value="all" />
> >>>     </platform>
> >>>
> >>> The shouldRotateToOrientation javascript function is deprecated on
> cordova
> >>> ios 4.x.x
> >>>
> >>> https://issues.apache.org/jira/browse/CB-5690
> >>> https://issues.apache.org/jira/browse/CB-8893
> >>>
> >>>
> >>>
> >>>
> >>> 2016-01-07 6:38 GMT+01:00 Dmitry Blotsky <db...@microsoft.com>:
> >>>
> >>>> Hey folks,
> >>>>
> >>>> I’ve had a bug forwarded my way where a Cordova app wouldn’t switch
> >>>> orientation on iOS unless the following code was present:
> >>>>
> >>>> function onDeviceReady() {
> >>>>     ...
> >>>>     window.shouldRotateToOrientation = function (degrees) {
> >>>>         return true;
> >>>>     }
> >>>>     ...
> >>>> };
> >>>>
> >>>> Could someone please explain why it is needed? Is this in one of our
> >>>> plugins? And perhaps also: what else/instead is needed to have a
> Cordova
> >>>> app properly support flipping of screen orientation?
> >>>>
> >>>> Kindly,
> >>>> Dmitry
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> >> For additional commands, e-mail: dev-help@cordova.apache.org
> >>
> >
> >
> >
> > --
> >
> ===========================================================================
> > Raymond Camden, Developer Advocate for MobileFirst at IBM
> >
> > Email : raymondcamden@gmail.com
> > Blog : www.raymondcamden.com
> > Twitter: raymondcamden
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> > For additional commands, e-mail: dev-help@cordova.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>

Re: How does orientation work, and what is shouldRotateToOrientation?

Posted by Shazron <sh...@gmail.com>.
There's an issue in JIRA to change the implication of 'default' in
iOS. "Technically" what we are doing is "correct", but we're in the
position to make things equal on all platforms. What do you all think?

But then of course changing it now is a breaking change, so damned if
you damned if you don't...

On Fri, Jan 8, 2016 at 6:31 AM, Raymond Camden <ra...@gmail.com> wrote:
> This bit me once too:
>
> http://www.raymondcamden.com/2015/11/09/cordova-ios-and-orientation-wondering-why-it-is-locked
>
> Definitely documented - but definitely not what I expected. ;)
>
> On Thu, Jan 7, 2016 at 3:22 PM, Shazron <sh...@gmail.com> wrote:
>> What Julio said. The original intent for this was for a way for
>> Cordova users to control orientation dynamically (say a view you have
>> is supposed to work in landscape only) --  the orientation methods
>> currently are all static (Info.plist based).
>>
>> On Wed, Jan 6, 2016 at 11:01 PM, julio cesar sanchez
>> <jc...@gmail.com> wrote:
>>> Can you share the whole bug report?
>>>
>>> On iOS the rotation doesn't work unless you configure it on the config.xml
>>>
>>>     <platform name="ios">
>>>         <preference name="Orientation" value="all" />
>>>     </platform>
>>>
>>> The shouldRotateToOrientation javascript function is deprecated on cordova
>>> ios 4.x.x
>>>
>>> https://issues.apache.org/jira/browse/CB-5690
>>> https://issues.apache.org/jira/browse/CB-8893
>>>
>>>
>>>
>>>
>>> 2016-01-07 6:38 GMT+01:00 Dmitry Blotsky <db...@microsoft.com>:
>>>
>>>> Hey folks,
>>>>
>>>> I’ve had a bug forwarded my way where a Cordova app wouldn’t switch
>>>> orientation on iOS unless the following code was present:
>>>>
>>>> function onDeviceReady() {
>>>>     ...
>>>>     window.shouldRotateToOrientation = function (degrees) {
>>>>         return true;
>>>>     }
>>>>     ...
>>>> };
>>>>
>>>> Could someone please explain why it is needed? Is this in one of our
>>>> plugins? And perhaps also: what else/instead is needed to have a Cordova
>>>> app properly support flipping of screen orientation?
>>>>
>>>> Kindly,
>>>> Dmitry
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
>> For additional commands, e-mail: dev-help@cordova.apache.org
>>
>
>
>
> --
> ===========================================================================
> Raymond Camden, Developer Advocate for MobileFirst at IBM
>
> Email : raymondcamden@gmail.com
> Blog : www.raymondcamden.com
> Twitter: raymondcamden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: How does orientation work, and what is shouldRotateToOrientation?

Posted by Raymond Camden <ra...@gmail.com>.
This bit me once too:

http://www.raymondcamden.com/2015/11/09/cordova-ios-and-orientation-wondering-why-it-is-locked

Definitely documented - but definitely not what I expected. ;)

On Thu, Jan 7, 2016 at 3:22 PM, Shazron <sh...@gmail.com> wrote:
> What Julio said. The original intent for this was for a way for
> Cordova users to control orientation dynamically (say a view you have
> is supposed to work in landscape only) --  the orientation methods
> currently are all static (Info.plist based).
>
> On Wed, Jan 6, 2016 at 11:01 PM, julio cesar sanchez
> <jc...@gmail.com> wrote:
>> Can you share the whole bug report?
>>
>> On iOS the rotation doesn't work unless you configure it on the config.xml
>>
>>     <platform name="ios">
>>         <preference name="Orientation" value="all" />
>>     </platform>
>>
>> The shouldRotateToOrientation javascript function is deprecated on cordova
>> ios 4.x.x
>>
>> https://issues.apache.org/jira/browse/CB-5690
>> https://issues.apache.org/jira/browse/CB-8893
>>
>>
>>
>>
>> 2016-01-07 6:38 GMT+01:00 Dmitry Blotsky <db...@microsoft.com>:
>>
>>> Hey folks,
>>>
>>> I’ve had a bug forwarded my way where a Cordova app wouldn’t switch
>>> orientation on iOS unless the following code was present:
>>>
>>> function onDeviceReady() {
>>>     ...
>>>     window.shouldRotateToOrientation = function (degrees) {
>>>         return true;
>>>     }
>>>     ...
>>> };
>>>
>>> Could someone please explain why it is needed? Is this in one of our
>>> plugins? And perhaps also: what else/instead is needed to have a Cordova
>>> app properly support flipping of screen orientation?
>>>
>>> Kindly,
>>> Dmitry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>



-- 
===========================================================================
Raymond Camden, Developer Advocate for MobileFirst at IBM

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: How does orientation work, and what is shouldRotateToOrientation?

Posted by Shazron <sh...@gmail.com>.
What Julio said. The original intent for this was for a way for
Cordova users to control orientation dynamically (say a view you have
is supposed to work in landscape only) --  the orientation methods
currently are all static (Info.plist based).

On Wed, Jan 6, 2016 at 11:01 PM, julio cesar sanchez
<jc...@gmail.com> wrote:
> Can you share the whole bug report?
>
> On iOS the rotation doesn't work unless you configure it on the config.xml
>
>     <platform name="ios">
>         <preference name="Orientation" value="all" />
>     </platform>
>
> The shouldRotateToOrientation javascript function is deprecated on cordova
> ios 4.x.x
>
> https://issues.apache.org/jira/browse/CB-5690
> https://issues.apache.org/jira/browse/CB-8893
>
>
>
>
> 2016-01-07 6:38 GMT+01:00 Dmitry Blotsky <db...@microsoft.com>:
>
>> Hey folks,
>>
>> I’ve had a bug forwarded my way where a Cordova app wouldn’t switch
>> orientation on iOS unless the following code was present:
>>
>> function onDeviceReady() {
>>     ...
>>     window.shouldRotateToOrientation = function (degrees) {
>>         return true;
>>     }
>>     ...
>> };
>>
>> Could someone please explain why it is needed? Is this in one of our
>> plugins? And perhaps also: what else/instead is needed to have a Cordova
>> app properly support flipping of screen orientation?
>>
>> Kindly,
>> Dmitry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: How does orientation work, and what is shouldRotateToOrientation?

Posted by julio cesar sanchez <jc...@gmail.com>.
Can you share the whole bug report?

On iOS the rotation doesn't work unless you configure it on the config.xml

    <platform name="ios">
        <preference name="Orientation" value="all" />
    </platform>

The shouldRotateToOrientation javascript function is deprecated on cordova
ios 4.x.x

https://issues.apache.org/jira/browse/CB-5690
https://issues.apache.org/jira/browse/CB-8893




2016-01-07 6:38 GMT+01:00 Dmitry Blotsky <db...@microsoft.com>:

> Hey folks,
>
> I’ve had a bug forwarded my way where a Cordova app wouldn’t switch
> orientation on iOS unless the following code was present:
>
> function onDeviceReady() {
>     ...
>     window.shouldRotateToOrientation = function (degrees) {
>         return true;
>     }
>     ...
> };
>
> Could someone please explain why it is needed? Is this in one of our
> plugins? And perhaps also: what else/instead is needed to have a Cordova
> app properly support flipping of screen orientation?
>
> Kindly,
> Dmitry