我是钛的新手,我只是通过查看动画来查看,但我没有得到正确的概念,但这是我迄今为止尝试过的代码
MainFunctions.someTestMethod = function(sender){
var cardDetailsView = Titanium.UI.createView({
backgroundColor:"red",
name:"cardDetails",
});
var cardImageView = Titanium.UI.createView({
backgroundColor:"pink",
name:"cardImage",
});
var containerView = Titanium.UI.createView();
containerView.backgroundColor="green";
var cardAnimation = Titanium.UI.createAnimation();
cardAnimation.view=cardDetailsView;
cardAnimation.transition= Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT;
cardAnimation.duration=2500;
//cardImageView.animate({opacity:1,duration:2000,});
//cardImageView.animate(cardAnimation);
//Click event for when you press the card view you will see the card info page
cardImageView.addEventListener("click", function(e) {
Ti.API.log("card back event called");
cardImageView.animate({
view : cardDetailsView,
opacity:1,
transition : Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT,
duration : 500
});
});
cardDetailsView.addEventListener("click",function(e){
Ti.API.log("cardDetailsView event called");
cardDetailsView.animate({
view : cardImageView,
opacity:1,
transition : Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT,
duration : 500
});
});
containerView.add(cardImageView);
containerView.add(cardDetailsView);
cardWindow.add(containerView);
};
在控制台中,我将此作为警告
[WARN] : New layout set while view [object TiUIView] animating: Will relayout after animation.
我被困在这里的问题是翻转动画,当我点击cardImageView它翻转并显示cardDetailsView时会发生什么,但当我点击cardDetailsView时它不会翻转显示cardImageView和应用程序崩溃。
你能帮我解决一下这里发现的问题我不知道是什么阻止了这个问题,我甚至试图破解厨房水槽演示,但仍然没有运气。
请帮我发现问题, 感谢。