2011-08-16 118 views
1

我在應用程序啓動時使用了Ti.UI.orientation = Ti.UI.LANDSCAPE_LEFT,這將其轉變爲橫向,但是有一個短的旋轉動畫。如何在橫向模式下啓動Titanium iPad應用程序?

有沒有辦法讓它在景觀中啓動以避免這種情況?

+0

強制定向模式被認爲是不好的做法,請參閱:http://docs.appcelerator.com/platform/latest/#!/guide/Orientation-section-src-29004932_Orientation-Limitingorientationmodessupportedbyawindow – Garre

回答

1

嘗試添加以下到您的tiapp.xml

<iphone> 
     <orientations device="iphone"> 
      <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> 
     </orientations> 
     <orientations device="ipad"> 
      <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> 
     </orientations> 
</iphone> 

請注意,您仍然需要爲窗口提供定向的喜好,但我相信這將解決上發佈您的問題。您需要刷新/build/iphone/(或類似文件夾)文件夾才能應用更改。

+0

我已經有了我的tiapp.xml如此設置,不幸的是仍然在應用程序啓動時獲得輪換 – evilcelery

1

您在示例中給出的代碼Ti.UI.orientation = Ti.UI.LANDSCAPE_LEFT已棄用,每http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI-module

而是在創建窗口後設置窗口的orientationModes屬性。以下是我有一個應用程序,我寫在那裏我限制設備的縱向模式:

 var win = Ti.UI.createWindow({ 
     backgroundColor: st.ui.theme.backgroundColor, 
     fullscreen: true, 
     navBarHidden: true, 
     exitOnClose: true 
    }); 
    win.orientationModes = [Ti.UI.PORTRAIT]; 

相反的win.orientationModes = [Ti.UI.PORTRAIT];你應該嘗試win.orientationModes = [Ti.UI.LANDSCAPE_LEFT];,看看那裏得到你。

相關問題