Skip to content

Commit 4f668db

Browse files
committed
一些细节的优化
1 parent 12d3a77 commit 4f668db

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

CustomTransition/CustomTransition-Swift/CustomTransition-Swift/Cross Dissolve/HalfWaySpringAnimator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import UIKit
1212
class HalfWaySpringAnimator: NSObject, UIViewControllerAnimatedTransitioning {
1313
/// 设置动画的持续时间
1414
func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
15-
return 1
15+
return 2
1616
}
1717

1818
/// 设置动画的进行方式,附有详细注释,demo中其他地方的这个方法不再解释

CustomTransition/CustomTransition-Swift/CustomTransition-Swift/Custom Presentation/CustomPresentationController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CustomPresentationController: UIPresentationController, UIViewControllerTr
1212

1313
let CORNER_RADIUS: CGFloat = 16
1414
var presentationWrappingView: UIView? = nil // 被添加动画效果的view,在presentedViewController的基础上添加了其他效果
15-
var dimmingView: UIView? = nil
15+
var dimmingView: UIView? = nil // alpha为0.5的黑色蒙版
1616

1717
override init(presentedViewController: UIViewController, presentingViewController: UIViewController) {
1818
super.init(presentedViewController: presentedViewController, presentingViewController: presentingViewController)

CustomTransition/CustomTransition-Swift/CustomTransition-Swift/Custom Presentation/CustomPresentationFirstViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class CustomPresentationFirstViewController: UIViewController {
1515
override func viewDidLoad() {
1616
super.viewDidLoad()
1717
setupView() // 主要是一些UI控件的布局,可以无视其实现细节
18+
19+
customPresentationSecondViewController.transitioningDelegate = customPresentationController
1820
}
1921

2022
override func didReceiveMemoryWarning() {
@@ -26,7 +28,6 @@ class CustomPresentationFirstViewController: UIViewController {
2628
// MARK: - UI事件处理
2729
extension CustomPresentationFirstViewController {
2830
func animationButtonDidClicked() {
29-
customPresentationSecondViewController.transitioningDelegate = customPresentationController
3031
self.presentViewController(customPresentationSecondViewController, animated: true, completion: nil)
3132
}
3233

0 commit comments

Comments
 (0)