2016-06-28 9 views
0

Ich bin neu in Swift und iPhone-Entwicklung. Kürzlich arbeite ich an einem Thema, bei dem ich das Bild vertikal drehen muss.Swift Image Rotation zeigt 50% Bild

Ich habe das Problem fast gelöst, aber Problem ist mein Bild dreht sich, aber während es dreht, zeigt es 50% Bild. Hier ist der Link des Problems in Video. http://screencast.com/t/VI4yZ0a8Wr

Auch hier ist der Code, den ich bin mit

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) 

    }) 
} 

Es wäre sehr hilfreich, wenn jemand mir auf diesem helfen kann.

Vielen Dank im Voraus,

Nixon

Antwort

0

es ist keine Animation Problem Vielleicht versuchen, den Aspekt und Content-Modus Ihres UIImageView auf diese

imageView.contentMode = UIViewContentMode.ScaleAspectFit 

Weitere Daten zu UIViewContentMode Aufzählung Einstellung here

+0

Ich denke, es ist nicht das Problem. Weil ich Aspect Fit bereits vom Storyboard eingestellt habe. http://screencast.com/t/RfoIvZP5e. habe auch deine Lösung ausprobiert, es hat nicht funktioniert. :( – nixon1333