【问题标题】:Passing CGPoint position to another ViewController - Swift - Programmatically将 CGPoint 位置传递给另一个 ViewController - Swift - 以编程方式
【发布时间】:2020-08-21 08:17:22
【问题描述】:

我有 2 个视图控制器:

  1. VC1
  2. VC2

(VC2 呈现在 VC1 之上)

每当我在 VC2 中时,我都需要提前知道 VC1 的子视图的 (CGPoint) 位置,以便我可以应用动画来关闭 VC2。

我考虑过实现委托和协议,这就是我所做的:

protocol PreviewCapturedViewControllerDelegate {
    func retrieveIconPosition() -> CGPoint
    func goToProfilePosition()
}

但我实际上不知道如何使用此协议检索视图的位置。

【问题讨论】:

标签: swift delegates protocols cgpoint


【解决方案1】:

我使用协议和委托解决了这个问题: 当你呈现 VC2 时,你传递了 CGPoint 坐标,然后你在 VC2 中使用它来解除它以制作动画

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-27
    • 2016-05-22
    相关资源
    最近更新 更多