when I try to run [self setNeedsDisplay:YES] in my ViewController it crashes with unrecognized selector sent to instance... is there something I'm doing wrong?
I'm using:
-(void) drawRect: (CGRect)rect {
///code...
}
when I try to run [self setNeedsDisplay:YES] in my ViewController it crashes with unrecognized selector sent to instance... is there something I'm doing wrong?
I'm using:
-(void) drawRect: (CGRect)rect {
///code...
}
Try:
[self.view setNeedsDisplay:YES]
You can send setNeedsDisplay:
message only to UIView based classes. You can effectively override drawRect
: message only for UIView based classes.
-setNeedsDisplay: is a method from NSView, UIView doesn't have the (pretty much useless) boolean flag. You must call setNeedsDisplay
instead. So call (from your view controller):
[[self view] setNeedsDisplay];
No parameter...