internalContentSize() - 方法不会覆盖其超类中的任何方法 [英] intrinsicContentSize() - Method does not override any method from its superclass

查看:36
本文介绍了internalContentSize() - 方法不会覆盖其超类中的任何方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新到 Xcode 8 beta 5,现在在继承自 UIView 的类上出现以下错误:

I updated to Xcode 8 beta 5, and now get the following error on a class that inherits from UIView:

Method does not override any method from its superclass

override public func intrinsicContentSize() -> CGSize
{
   ...
}

有解决方法吗?

推荐答案

请查看 最新参考.(您只需在 Apple 开发者网站 的搜索栏中输入intrinsicContentSize"一词即可轻松找到它.)

Please check the latest reference. (You can easily find it just putting the word "intrinsicContentSize" in the searchbar of Apple's developer site.)

声明

var intrinsicContentSize: CGSize { get }

intrinsicContentSize 已经变成了计算属性,所以需要这样覆盖:

intrinsicContentSize has become a computed property, so you need to override it in this way:

override open var intrinsicContentSize: CGSize {
    get {
        //...
        return someCGSize
    }
}

或者干脆:

override open var intrinsicContentSize: CGSize {
    //...
    return someCGSize
}

这篇关于internalContentSize() - 方法不会覆盖其超类中的任何方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆