Reputation: 40664
Here is a code fragment
#import "MyCustomView.h"
@implementation MyCustomView
-(void) drawRect:(CGRect)rect {
NSLog(@"Help");
CGContextRef myContext = [[NSGraphicsContext // 1
currentContext]graphicsPort];
....
Then at 1, I encountered this error message:
NSGraphicsContext undeclared (first use in this function)
Do you have any idea what caused it? Any header file I should include?
Upvotes: 1
Views: 959
Reputation: 9364
On iOS you have to use UIGraphicsGetCurrentContext()
to get the current CGContext. Your call is valid on Mac OS.
Upvotes: 7
Reputation: 5951
#import <UIKit/UIKit.h>
(usually done in the .h file) should do it as long as you haven't removed the UIKit Framework from your project.
Upvotes: 1