OGeek|极客世界-中国程序员成长平台

标题: ios - super.init() 无法在 swift3 中调用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:00
标题: ios - super.init() 无法在 swift3 中调用

调用super.init()时,报错:

Must call a designated initializer of the superclass 'UICollectionViewCell'.

当我在 swift 2.2 版中使用它时,它确实工作得很好。

但是一旦我将 Xcode 版本升级到 8.0,我一直在使用 Swift 3.0 版本并且 super.init() 对我不起作用。



Best Answer-推荐答案


从 swift3 开始,他们已经删除了 UICollectionViewCell 的 init()。所以你必须使用 super.init(frame: CGRect) 而不是普通的 init()。

关于ios - super.init() 无法在 swift3 中调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40458323/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4