你几乎只做了一些改变
// These values depends on the positioning of your element let left = CGAffineTransformMakeTranslation(-300, 0) let right = CGAffineTransformMakeTranslation(300, 0) let top = CGAffineTransformMakeTranslation(0, -300) UIView.animateWithDuration(0.4, delay: 0.0, options: [], animations: { // Add the transformation in this block // self.container is your view that you want to animate self.container.transform = top }, completion: nil)