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