繁体   English   中英

Segue Right Left过渡

[英]Segue Right Left transition

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

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右转左转,那么将该视图推入UINavigationViewController并从左到右转换弹出视图到根视图。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM