使用钛合金的翻转动画的错误

时间:2015-01-03 21:07:45

标签: javascript ios titanium titanium-alloy

我正在使用Titanium Alloy来构建iOS应用。我遇到了一个特别令人沮丧的问题,我现在已经坚持了很长时间。

用户登录后,我的目标是让登录窗口动画(翻转)到仪表板窗口。除了这个错误之外,这很有效。在播放器仪表板栏向下跳到正确位置之前,登录导航顶部栏似乎显示一秒钟。

在翻转动画完成之前看起来像这样: It looks like this until the animation completes.

完成动画后,它跳转到: After animation completed

仪表板页面是一个TabGroup,类似于此,初始选项卡的标题为“Player”:

<TabGroup>
    <Tab icon="player_icon.png">
        <Window id="playerTab" title="Player"/>
    </Tab>
</TabGroup>

登录控制器是一个带有登录窗口和注册窗口的NavigationWindow。

在成功提交登录表单后,我创建了索引控制器(仪表板):

Alloy.createController('index', { animate: true, loginSuccess: true });

其中包含初始化代码:

if (!AppData.isLoggedIn() && !args['loginSuccess']) {
    // Splash contains the register/login forms
    Alloy.createController('splash');
} else {
    // Check if the user is logging in or resuming previous state
    if(args['animate']) {
        $.index.open({ transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT });
    } else {
        $.index.open();
    }
}

有没有人知道为什么会出现这个错误?我感谢任何帮助!

谢谢!

1 个答案:

答案 0 :(得分:1)

想出来!事实证明,在动画结束之前,翻转动画并不考虑状态栏高度,因此我为TabGroup设置了初始上边距20,并在动画完成后删除了边距。

现在很棒!