gpt4 book ai didi

ios - Segue 右左过渡

转载 作者:可可西里 更新时间:2023-10-31 23:44:21 26 4
gpt4 key购买 nike

我有一些代码这是描述从左到右过渡的代码

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()
}
})

}

我只需要从右到左的过渡

最佳答案

要提供过渡动画效果,请移除您已完成的那些繁忙工作,然后转到 UINavigationViewController,它将允许推送和弹出动画以供查看,并为每个过渡保持低磁盘空间。如果您希望 UIViewController 从右到左过渡,则将该 View 插入 UINavigationViewController 并将弹出 View 从左到右过渡到 Root View 。

关于ios - Segue 右左过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34394328/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com