简体   繁体   中英

Trying to use setNeedsDisplay()

I'm trying to reload the UIView. Actually I get an error

Cannot convert value of type 'HomeViewController' to expected argument type 'UIView'

So this is the code:

UIView.setNeedsDisplay(self)

Do you have any idea?

UIView is a class, and setNeedsDisplay() is an instance function.

You want to be calling this function on the UIView instance (not the class itself). 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM