So I have been searching for a solution for this a while now, and I just can't figure out what is wrong. Not use objectice c long, a few days. So, the issue is this:
So, I have created these: PaintingTestViewController.h PaintingTestViewController.m PaintingTestviewController.xib
I then create TestDraw.h TestDraw.m
Doubleclick on the xib file, I create a new view, select it, open the inspector, and set class to point to TestDraw.
I then open TestDraw.m and remove the comments around - void Drawrect...
Inside this method I have added
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGFloat components[] = {0.0, 0.0, 1.0, 1.0};
CGColorRef color = CGColorCreate(colorspace, components);
CGContextSetStrokeColorWithColor(context, color);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 300, 400);
CGContextStrokePath(context);
CGColorSpaceRelease(colorspace);
CGColorRelease(color);
I have tested this before with an application which only has the view, and not the view controller. However now I get a bunch of errors
.. .. -[TestDraw drawRect:] in TestDraw.o "_CGContextStrokePath", referenced from: -[TestDraw drawRect:] in TestDraw.o "_CGContextAddLineToPoint", referenced from: -[TestDraw drawRect:] in TestDraw.o ld: symbol(s) not found
So, it seems the CGContext "methods" are not recognized.
I need to use the viewController and a separate view inside because I'm using Unity for the main application, and this will just be a small part of a bigger application. But, because of performance reasons (it's a drawing app), I need to use native code.
Ok, I hope somebody will be able to help me. Thank you so much!