2
我试图按下按钮时旋转和图像180度。现在我可以让它旋转180度,但是当我再次按下按钮时,图像不会回转。我觉得我错过了一些简单的东西。旋转按钮上的图像按
if语句正在工作,我只是简化了代码,只留下了不工作的部分。
if(self.dropdownConstraint.constant == -78)
{
//roate arrow up
UIView.animateWithDuration(0.5, animations: {
self.arrow.transform = CGAffineTransformMakeRotation((180.0 * CGFloat(M_PI))/180.0)
self.view.layoutIfNeeded()
})
}
else
{
//roate arrow down
UIView.animateWithDuration(0.5, animations: {
self.arrow.transform = CGAffineTransformMakeRotation((-180.0 * CGFloat(M_PI))/-180.0)
self.view.layoutIfNeeded()
})
}
在此先感谢!
感谢我认为它必须是简单的东西 – icekomo