我在应用程序启动时使用了Ti.UI.orientation = Ti.UI.LANDSCAPE_LEFT
,这将其转变为横向,但是有一个短的旋转动画。如何在横向模式下启动Titanium iPad应用程序?
有没有办法让它在景观中启动以避免这种情况?
我在应用程序启动时使用了Ti.UI.orientation = Ti.UI.LANDSCAPE_LEFT
,这将其转变为横向,但是有一个短的旋转动画。如何在横向模式下启动Titanium iPad应用程序?
有没有办法让它在景观中启动以避免这种情况?
尝试添加以下到您的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/
(或类似文件夹)文件夹才能应用更改。
我已经有了我的tiapp.xml如此设置,不幸的是仍然在应用程序启动时获得轮换 – evilcelery
您在示例中给出的代码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];
,看看那里得到你。
强制定向模式被认为是不好的做法,请参阅:http://docs.appcelerator.com/platform/latest/#!/guide/Orientation-section-src-29004932_Orientation-Limitingorientationmodessupportedbyawindow – Garre