测试已测试 | ✗ |
语语言 | SwiftSwift |
许可证 | MIT |
发布上次发布 | 2017年4月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Urtaq 维护。
在 Swift3 视图控制器之间带有模糊效果的移动视图转换
此代码风格采用 协议面向编程
。
因此,您无需继承。只需实现协议。
您可以处理一些参数来自定义此过渡。例如,比例、持续时间等。
请参阅 Example
文件夹。
运行 pod install
并打开 .xcworkspace 文件。
import URMovingTransitionAnimator
class viewController: UIViewController, URMovingTransitionMakable {
...
override func viewDidLoad() {
super.viewDidload()
self.initMovingTrasitionGesture()
...
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.initMovingTransitionNavigationDelegate()
...
}
deinit {
self.removeMovingTransitionGesture()
...
}
...
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
...
if let cell = tableView.cellForRow(at: indexPath) as? URExampleTableViewCell {
self.makeBlurredTransitionAnimator(target: cell.imgView, baseOn: tableView.superview!, duration: 0.8)
// if you want to add scaling animation, use makeTransitionAnimator function like below
// At the beginning, the scaling animation will be showed!!
// self.makeBlurredTransitionAnimator(target: cell.imgView, baseOn: tableView.superview!, duration: 0.8, needScaleEffect: true, scale: 1.05)
// if you want to transition without the blur effect, you can use this make function!!
// self.makeTransitionAnimator(target: cell.imgView, baseOn: tableView.superview!, duration: 0.8, needScaleEffect: true, scale: 1.05)
}
...
// push view controller
}
...
}
class finishViewController: UIViewController, URMovingTransitionReceivable {
...
var transitionView: UIView?
...
func transitionFinishingFrame(startingFrame: CGRect) -> CGRect {
let frame = {view's frame to be the destination}
let finishingFrame = CGRect(origin: CGPoint(x: 0, y: 64), size: frame.size)
return finishingFrame
}
...
}
URMovingTransitionAnimator 可在 MIT 许可证下获取。有关更多信息,请参阅 LICENSE 文件。