Question

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

Was it helpful?

Solution

case sensitivity matters, b.t.w.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top