方向纵向和PortraitUpSideDown仅适用于一个窗口 [英] Orientation Portrait and PortraitUpSideDown Only For One Window

查看:696
本文介绍了方向纵向和PortraitUpSideDown仅适用于一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10个窗口.

初始窗口是loginWindow,我想为Portrait和PortraitUpSideDown设置方向. 对于其余的窗口,将具有横向和纵向方向.

The initial window is loginWindow i want to set orientation for Portrait and PortraitUpSideDown. For remaining windows will have landscape and portrait orientation.

在Tiapp.xml中

in Tiapp.xml

        <key>UISupportedInterfaceOrientations~iphone</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>

为我的应用设置了所有方向,从而启用了纵向,人像倒置,landscapeLeft和landscapeRight.

Which set all orientation for my application which enables portrait,portraitupsidedown,landscapeLeft and landscapeRight.

对于LoginWindow,我只需要portrait和portraitUpSideDown.
窗口的其余部分确实具有纵向,人像倒置,landscapeLeft和landscapeRight的所有方向.

I need those only portrait and portraitUpSideDown for LoginWindow.
Rest of window do have all the orientation which is portrait,portraitupsidedown,landscapeLeft and landscapeRight.

任何人都可以建议我如何为我的应用程序获得这种行为.

Can any one suggest me how can i able to get this behaviours for my application.

推荐答案

您需要使用不同的窗口,并为每个窗口定义要允许的方向.

You need to use different windows and define for each window which orientation you want to allow.

我的意思是,您必须像这样创建loginWindow:

I mean, you have to create loginWindow like this:

var loginWindow = Ti.UI.createWindow({
    orientationModes : [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT],
    fullscreen : false,
    navBarHidden : true

});
winPortrait.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT];

您要允许所有方向的Windows必须这样创建:

Windows where you want to allow all orientations, have to been created like this:

var appWindow = Titanium.UI.createWindow({

    width : Ti.UI.FILL,
    height : Ti.UI.FILL,
    fullscreen : false,
    navBarHidden : true,
    orientationModes : [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
});
appWindow.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT];

希望有帮助

这篇关于方向纵向和PortraitUpSideDown仅适用于一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆