菜鸟教程小白 发表于 2022-12-11 18:00:18

ios - super.init() 无法在 swift3 中调用


                                            <p><p>调用<code>super.init()</code>时,报错:</p>

<blockquote>
<p>Must call a designated initializer of the superclass &#39;UICollectionViewCell&#39;.</p>
</blockquote>

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

<p>但是一旦我将 Xcode 版本升级到 8.0,我一直在使用 Swift 3.0 版本并且 <code>super.init()</code> 对我不起作用。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>从 swift3 开始,他们已经删除了 UICollectionViewCell 的 init()。所以你必须使用 super.init(frame: CGRect) 而不是普通的 init()。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - super.init() 无法在 swift3 中调用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/40458323/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/40458323/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - super.init() 无法在 swift3 中调用