[英]Trying to use setNeedsDisplay()
I'm trying to reload the UIView. 我正在尝试重新加载UIView。 Actually I get an error
其实我得到一个错误
Cannot convert value of type 'HomeViewController' to expected argument type 'UIView'
无法将类型“ HomeViewController”的值转换为预期的参数类型“ UIView”
So this is the code: 所以这是代码:
UIView.setNeedsDisplay(self)
Do you have any idea? 你有什么主意吗?
UIView
is a class, and setNeedsDisplay()
is an instance function. UIView
是一个类,而setNeedsDisplay()
是一个实例函数。
You want to be calling this function on the UIView
instance (not the class itself). 您想在
UIView
实例 (而不是类本身)上调用此函数。 So you want: 所以你要:
self.view.setNeedsDisplay();
setNeedsDisplay()
also doesn't take any arguments, so I don't know why you were trying to pass self
into it. setNeedsDisplay()
也不接受任何参数,所以我不知道您为什么尝试将self
传递给它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.