0
我想表示在iphone屏幕上旋转的视图。我有一个按钮,当你按下它时,视图旋转180度。iphone:重复转换
我的问题是,这只是第一次。
下面是代码:
-(IBAction) flip:(id)sender{
CGAffineTransform transform; //the transform matrix to be used below
//BEGIN ANIMATIONS
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
//animate
if (flag){
transform = CGAffineTransformMakeRotation(RADIANS(180));
} else {
transform = CGAffineTransformMakeRotation(RADIANS(-180));
}
flag = !flag;
transform = CGAffineTransformTranslate(transform, 0, 0);
self.mySuview.transform = transform;
//COMMIT ANIMATIONS
[UIView commitAnimations];
}
第一次单击,视图旋转好了,但是当你再次单击什么也不会发生。没有错误,没有改变的观点。
我错过了什么?
感谢 Gonso
尝试调试此方法以检查是否按预期方式处理它 – Vladimir 2010-05-04 10:48:21
是方法每次都运行,但没有任何反应 – gonso 2010-05-06 10:11:09