I've asked another question regarding this project before and Travis was super helpful. Previous question
Taking that advice into mind I'm trying to create a subclass for the C4Shape class, I added 2 properties (both floats) to the class for X and Y position values. The reason I'm not just calling the .center property of a C4Shape is because for adding them to the canvas I prefer to use the top left corner instead of the center.
I'm trying to write a custom Init method for this new class, however I'm getting an error.
Here is the custom init code I'm working with:
customShape.m
- (id)initWithColor:(UIColor *)fillColor atX:(float)_xValue atY:(float)_yValue
{
CGRect frame = CGRectMake(_xValue, _yValue, 100, 100);
self = [customShape rect:frame];
self.lineWidth = 0.0f;
self.fillColor = fillColor;
self.xValue = _xValue;
self.yValue = _yValue;
return self;
}
C4WorkSpace.m
-(void)setup {
customShape *testShape = [[customShape alloc]initWithColor:[UIColor greenColor] atX:50.0f atY:50.0f];
[self.canvas addShape:testShape];
}
I suspect the culprit is self = [customShape rect:frame];
This is the warning I see: "Incompatible pointer type assigning to 'customeShape *_strong' from 'C4Shape *'"
The actual error that gets thrown when I try to run this is: "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[C4Shape setXValue:]: unrecognized selector sent to instance 0x9812580'"
As before I'm making buttons that can hold a color value and when you tap that button it will send a UDP packet with that buttons fillColor as well as the iPads IP.