首页 > 解决方案 > 无法在表单样式控制器上显示控制器

问题描述

我正在研究自定义演示样式并遇到一个问题。我使用的是https://github.com/ergunemr/BottomPopup库,但无法在可见上下文中呈现!

在此处输入图像描述

BottomPopupPresentAnimator我已经在课堂上更改了以下方法中的代码

func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        let toVC = transitionContext.viewController(forKey: .to)! // sub
        let fromVC = transitionContext.viewController(forKey: .from)!  // plan
        transitionContext.containerView.addSubview(toVC.view)
        let presentFrame = transitionContext.finalFrame(for: fromVC)
        let initialFrame = CGRect(origin: CGPoint(x: 0, y: fromVC.view.frame.height), size: presentFrame.size)
        toVC.view.frame = initialFrame
        UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: {
            toVC.view.frame = presentFrame
        }) { (_) in
            transitionContext.completeTransition(true)
        }
    }

我实现的是

在此处输入图像描述

我已经尝试过不同类型的演示风格组合

谁能建议这里有什么问题?我只想展示中间控制器(弹出设置)

标签: iosswiftanimationpresentmodalviewcontroller

解决方案


推荐阅读