gpt4 book ai didi

crash - Swift 3 - 自定义 segue 因 UIStoryboardSegueTemplate.m :85 而崩溃

转载 作者:行者123 更新时间:2023-12-03 16:48:43 24 4
gpt4 key购买 nike

据此link ,我正在尝试制作自己的自定义segue。

在初始 View Controller (标题:First)中,按 2 ( UIButton ) 转至 Second .

但应用程序总是在 performSegue(withIdentifier: "customSegue", sender: self) 崩溃出现错误:*** Assertion failure in -[UIStoryboardSegueTemplate segueWithDestinationViewController:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3599.6/UIStoryboardSegueTemplate.m:85
这是主要的 Storyboard:

enter image description here

碰撞:

enter image description here
CustomSegue

import UIKit

class CustomSegue: UIStoryboardSegue {

override func perform() {
let sourceView = source.view!
let destView = destination.view!

let screenWidth = UIScreen.main.bounds.size.width
let screenHeight = UIScreen.main.bounds.size.height

destView.frame = CGRect(x: 0, y: screenHeight, width: screenWidth, height: screenHeight)

let window = UIApplication.shared.keyWindow
window?.insertSubview(destView, aboveSubview: sourceView)

UIView.animate(withDuration: 0.4, animations: {
sourceView.frame = sourceView.frame.offsetBy(dx: 0.0, dy: -screenHeight)
destView.frame = destView.frame.offsetBy(dx: 0.0, dy: -screenHeight)
}) { [weak self] (finished) in
guard let strongSelf = self else { return }

strongSelf.source.present(strongSelf.destination, animated: false, completion: nil)
}

}
}
Second只是一个空的 View Controller :
import UIKit

class Second: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

}

我将项目中的设置与下载的示例进行比较,但找不到差异。

我应该如何解决这个崩溃?

最佳答案

对于那些有兴趣的人。

我花了将近 2 天的时间才找到这个:为了克服这个崩溃,我必须在 Storyboard 中指定“模块” - 单击 Segue - 属性检查器。

关于crash - Swift 3 - 自定义 segue 因 UIStoryboardSegueTemplate.m :85 而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39698537/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com