我正在尝试实现像这样的自定义segue动画
https://www.dropbox.com/s/ptyn84g7fdbthcc/video-1449571130.mp4.mp4?dl=0
现在我正在使用此代码
ViewController.swift
@IBAction func loginScreen(sender: UIButton)
{
self.performSegueWithIdentifier("customSegue", sender: self)
}
CustomSegue.swift
override func perform()
{
let sourceVC = self.sourceViewController
let destinationVC = self.destinationViewController
sourceVC.view.addSubview(destinationVC.view)
destinationVC.view.transform = CGAffineTransformMakeScale(0.05, 0.05)
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseInOut, animations: { () -> Void in
destinationVC.view.transform = CGAffineTransformMakeScale(1.0, 1.0)
}) { (finished) -> Void in
destinationVC.view.removeFromSuperview()
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(0.001 * Double(NSEC_PER_SEC)))
dispatch_after(time, dispatch_get_main_queue()) {
sourceVC.presentViewController(destinationVC, animated: false, completion: nil)
}
}
}
这是两个问题。首先是
显然,这段代码并不像我分享的视频那样靠近动画。我不知道应该设置哪些动画属性来复制动画,就像视频一样第二个问题是
在我的segue结束时,屏幕闪烁,好像在destination.removeFromSuperview()和source.present ...
之间有延迟。