嗨,我在我的iPhone应用程序中遇到了一些编码UIView动画的问题。我试图在更新框架属性后为UIView的框架设置一个动画。这是代码。UIView动画以错误的属性值开头
//old frame values are: 0, 0, 15, 37
//set the frame for hiding the arrow
[arrow setFrame:CGRectMake(-15, 100, 15, 37)];
//Create an animation to let the arrow slide in the view.
[UIView beginAnimations:@"SlideInArrow" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationBeginsFromCurrentState:true];
[UIView setAnimationDuration:1.0];
[symbolArrow setFrame:CGRectMake(0, 100, 18, 37)];
[UIView commitAnimations];
此代码是我写的方法的一部分。当用户按下按钮时它会被触发。我建议,UI不会将新的帧值更新到对象。相反,动画使用旧值。为什么这样?有没有办法让视图或动画获得新的帧值?
您隐藏arraow对象,但动画与symbolArrow.so,此行为.so给出确切的objectname你隐藏 –
哦,我没有复制第一行。箭头和符号箭头是同一个对象。我刚写了一个错误的名字。这意味着两条线“symbolArrow” – kshala
看到我更新的答案 –