0
我是swift和iPhone開發人員中的新成員。最近我正在研究一個主題,我必須垂直旋轉圖像。Swift Image Rotation顯示50%圖像
我幾乎解決了這個問題,但問題是我的圖像旋轉,但它旋轉時顯示50%的圖像。這是視頻中問題的鏈接。 http://screencast.com/t/VI4yZ0a8Wr
而且,這裏的代碼我使用
func animationRotationEffect(view:UIView,animationTime:Float)
{
UIView.animateWithDuration(NSTimeInterval(animationTime), animations: {() -> Void in
/* previously used
same result produced as below
var animation:CABasicAnimation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue(CATransform3D:CATransform3DMakeRotation(CGFloat(M_PI), 1, 0, 0))
animation.duration = CFTimeInterval(animationTime)
animation.cumulative = false
animation.repeatCount = 1
view.layer.addAnimation(animation, forKey: nil)
*/
let animate = CABasicAnimation(keyPath: "transform.rotation.x")
animate.duration = CFTimeInterval(animationTime)
animate.repeatCount = Float.infinity
animate.fromValue = 0.0
animate.toValue = Float(M_PI * 2.0)
view.layer.addAnimation(animate, forKey: nil)
})
}
這將是非常有益的,如果有人能幫助我在此。
由於提前,
尼克松
我認爲這不是問題。因爲我已經從故事板設置了Aspect Fit。 http://screencast.com/t/RfoIvZP5e。也試過你的解決方案,它沒有工作。 :( – nixon1333