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

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top