0
目前,我尝试在自定义的工作赛格瑞它应该看起来像:定制Segue公司正确的方式
[目标视图]应该是后面的[来源查看],这[来源查看]应该从100%动画下降到0.1%,然后删除,在动画时间[Destination View]也应该在后台。
因此,您看到[源视图]在[目的地视图]前变小并被移除。
这是我的代码:
import UIKit
class CustomSegueFromBigtoSmall: UIStoryboardSegue {
override func perform() {
let sourceVC = self.sourceViewController
let destinationVC = self.destinationViewController
sourceVC.view.addSubview(destinationVC.view)
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseInOut, animations: {() -> Void in
sourceVC.view.transform = CGAffineTransformMakeScale(0.1, 0.1)
}){ (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(), {() -> Void in
sourceVC.presentViewController(destinationVC, animated: false, completion: nil)
})
}
}
}
现在,我看到我的[来源查看],那瞬间就变成我的[目标视图]。
[目标视图]在黑色背景前变小。一旦它“小”,它就会显示为全屏。
示例(来自我的书)在这里:https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/bk2ch06p325customSegue/CustomSegue/ViewController.swift – matt