故事板中有 IBOutlet 连接内容 ScrollView 时崩溃

Crash when has IBOutlet connection contentScrollView in Storyboard

Storyboard 中,我有一个首字母 UIViewController (FirstViewController),模态呈现一个 UINavigationController,根 UIViewController (SecondViewController).

这个 SecondViewController 显示(例如推送)另一个 UIViewController (ThirdViewController) 有一个 UIScrollView 和一个 UIView,我把我的 content/components (我打电话给contentScrollView)。

在这个 ThirdViewController 中,我将 ScrollView 中的所有约束(顶部、前导、底部、尾随)与 superView 和 contentScrollView 的边距 0 放在一起superView(也就是 ScrollView)并且等于 ScrollView 的高度和宽度。在高度约束中,我将低优先级设置为 Xcode not show an error in constraints.

当我用这个 contentScrollView 为我的 ThirdViewController.swift 创建一个 IBOutlet 时,当我输入ThirdViewController.

我不知道我做错了什么,是约束还是其他配置。

应用程序崩溃并显示此日志:“[UIView refreshControl]:无法识别的选择器已发送至实例...”

当我以模态方式呈现这个 ThirdViewController 时,不会出现这个错误。

我做了一个示例项目来模拟这个错误:https://gitlab.com/lucas_foton/bugscrollview

您不需要为 contentScrollView 连接 IBOutlet,所以只要删除它,您的项目就不会崩溃。

编辑:

看起来问题出在你给 IBOutletcontentScrollView 名称上,如果我将它更改为 contentView 并且它工作正常。