3
我有一些代碼,這是描述從左至右Segue公司右左過渡
class AGSegue: UIStoryboardSegue
override func perform() {
let sourceViewController = self.sourceViewController
let destinationViewController = self.destinationViewController
// Creates a screenshot of the old viewcontroller
let duplicatedSourceView: UIView = sourceViewController.view.snapshotViewAfterScreenUpdates(false)
// the screenshot is added above the destinationViewController
destinationViewController.view.addSubview(duplicatedSourceView)
sourceViewController.presentViewController(destinationViewController, animated: false, completion: {
// it is added above the destinationViewController
destinationViewController.view.addSubview(duplicatedSourceView)
UIView.animateWithDuration(0.5, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut, animations: {() -> Void in
// slides the sourceViewController to the right
duplicatedSourceView.transform = CGAffineTransformMakeTranslation(sourceViewController.view.frame.size.width, 0)
}) { (finished: Bool) -> Void in
duplicatedSourceView.removeFromSuperview()
}
})
}
}
我只需要在正確的過渡到左