我在我的 TableView 中使用 UIRefreshControl
来提取新数据。但是当我定义控件时,下面的错误显示。我用谷歌搜索了一段时间,但没有找到任何有用的信息。
我使用 Xcode 版本 9.2 (9C40b)、swift4、IOS11.2
Cannot override mutable property 'refreshControl' of type 'UIRefreshControl?' with covariant type 'UIRefreshControl'
var refreshControl = UIRefreshControl()
最佳答案
如果要定义另一个控件,则更改名称... refreshControl
是自 iOS10/iOS6 [分别] 以来的 UIScrollView/UITableViewController
ivar。您正在尝试重新定义它,这就是导致错误的原因。或者您当然可以使用提供的一个。
你的意思可能是 self.refreshControl = UIRefreshControl()
关于ios - 无法使用协变类型 'refreshControl' 覆盖类型 'UIRefreshControl?' 的可变属性 'UIRefreshControl',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48299533/