在执行Segue时,我在iOS13中遇到了一个奇怪的错误,我无法理解它的含义,也找不到关于这个错误的任何文档.问题是,这似乎会导致很多延迟(几秒钟),直到执行segue.

2019-09-11 22:45:38.861982+0100 Thrive[2324:414597] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: ; layer = ; contentOffset: {0, 0}; contentSize: {315, 118}; adjustedContentInset: {0, 0, 0, 0}; dataSource: >

我正在使用Hero,但我try 禁用它,并使用常规Segue,但这并没有阻止延迟.

启动segue的代码是didSelectRowAt

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.section == 0 {
            selectedCell = realIndexFor(activeGoalAt: indexPath)
            performSegue(withIdentifier: "toGoalDetails", sender: nil)
        } else if indexPath.section == 1 {
            selectedCell = indexPath.row
            performSegue(withIdentifier: "toIdeaDetails", sender: nil)
        } else {
            selectedDecision = indexPath.row
            hero(destination: "DecisionDetails", type: .zoom)
        }
    }

然后,viewDidLoad或ViewWill中的任何代码都不会从目标VC中出现,对这一点没有任何影响(我试着对其进行注释,没有任何区别).

知道是什么原因吗?我可以分享任何其他需要的细节.

非常感谢.

推荐答案

这件事发生在我身上,因为我在ViewWillAspect(:) method. I moved the registration in the viewDidAppear(:)和Xcode中注册了用于更改方向通知的设备,它不再在断点处停止.

我能说的是,当视图已经可见时,可能会运行布局更改...

Swift相关问答推荐

AirPods手势不发送AVAudioApp静音状态通知

在列表项内的NavigationLink中的按钮无法正常工作

如何在一个角色隔离类上编写自定义==实现?

什么是Swift Concurrency中任务组的正常退出

UITableView未显示类数组数据

绑定到可选值的非可选属性?'

MyApp类型不符合协议App''''

是否在核心数据中使用Uint?

SwiftUI同心圆,通过逐渐出现来显示进度

如何在SwiftUI 4+(iOS 16+)中使用新的NavigationStack进行导航

Swift中从头开始的基本HTTP客户端

Swift通过设置变量B自动设置变量A的值

从一个范围减go 多个范围

Swift并发:为什么不在其他后台线程上执行任务

签署GoogleSignIn-GoogleSignIn需要开发团队

`@available` 属性在 macOS 版本上被错误地限制

CMutablePointer - 如何访问它?

iOS/Swift:如何检测 UITextField 上的touch 动作

在 Swift 中以编程方式更新约束的常量属性?

Void 函数中意外的非 Void 返回值 (Swift 2.0)