简体   繁体   中英

use of setNeedsDisplay

I'm confused with the different use of setNeedsDisplay to update an UIView ? I do get an error message (" No visible @interface for viewcontroller declares the selector setNeedsDisplay ") when I try to use:

[self.view setNeedsDisplay:YES];

I found out that I have to ignore the argument to make it work for UIViews:

[self.view setNeedsDisplay]

Why is the argument for the UIView update not needed here? (A lot of answers for how to use setNeedsDisplay suggests the first approach)

Thanks

case sensitivity matters, btw

change that to:

[self.view setNeedsDisplay];

And as you've discovered, you call " setNeedsDisplay " on the UIView object, not the UIViewController (which is the " No visible @interface for viewcontroller declares the selector 'setNeedsDisplay' " error you were seeing).

The place where " setNeedsDisplay: " takes a YES or NO parameter is on the Macintosh side , in NSView.

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