在iOS中,表单的翻转过渡并不顺畅

时间:2016-09-26 04:24:57

标签: codenameone

@Override
protected void postSplash(Form f) {
  f.animateHierarchyAndWait(2000);
  f.setTransitionInAnimator(null);
  f.setTransitionOutAnimator(new FlipTransition());
 }

表单的翻转动画可以在模拟器中运行,但是当我在iOS设备中测试时,看起来它在翻转时停止了一秒钟。

@Override
protected void beforeSplash(Form f) {
    f.getAllStyles().setBgColor(0x414143);
    f.getAllStyles().setBgTransparency(255);

    f.setLayout(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE));
    splashImg = theme.getImage("splash_bg.png");
    splashContainer = new Container(new FlowLayout(Label.CENTER));
    f.add(BorderLayout.CENTER, splashContainer);

    splashLabel = new Label();
    splashLabel.setIcon(splashImg.scaledWidth(Display.getInstance().getDisplayWidth() / 2 + 50));
    splashLabel.setVisible(false);
    splashContainer.add(splashLabel);
    splashContainer.getAllStyles().setMarginTop(Display.getInstance().getDisplayWidth()/3);
}

@Override
protected void postSplash(Form f) {
    splashLabel.setY(Display.getInstance().getDisplayHeight());
    splashLabel.setVisible(true);

    f.animateHierarchyAndWait(1000);
    f.setTransitionInAnimator(null);
    f.setTransitionOutAnimator(new FlipTransition());
}

1 个答案:

答案 0 :(得分:0)

iOS中的可变图像速度较慢。转换将UI绘制到纹理图像上以进行翻转,因此这需要花费一小部分时间才能引人注目。

通常它不应该引人注意,但绘制到可变图像比在iOS上绘制到屏幕要慢得多。因此,这在很大程度上取决于UI元素及其设计方面的内容。