Reputation: 736
I have an UIView Graph with main method and some other methods which draw various things. When the application starts, view is drawn fine and I have no problem with it. But when I try to use button (located on same UIView) to redraw something I just get error:
CGContextDrawPath: invalid context 0x0
button is not calling main drawRect method. Also if I try to use:
[self setNeedsDisplay:YES];
I get error:
No visible @interface for viewcontroller declares the selector 'setNeedsDisplay'
Upvotes: 3
Views: 8687
Reputation: 262
Try to use this method
- (void)setNeedsLayout
setNeedsLayout from developer.apple.com
Upvotes: 1
Reputation: 332
setNeedsDisplay
will not work for the subviews....it will work only for the View of a viewController
Upvotes: 5
Reputation: 108101
You are calling setNeedsDisplay
on the UIViewController
instance whereas you need to call it on its UIView
.
[self.view setNeedsDisplay:YES];
Upvotes: 0