Send copy of class to view class so it can render him? ( iPhone )
- by Johannes Jensen
I'm making a game for the iPhone, and I have a class called Robot.
Then I have a class called View, which renders everything.
I want to send a copy of my Robot, which I defined in my ViewController, and I send it to gameView (which is View *gameView), like this:
robot = [Robot new];
[gameView setRobot: [robot copy]];
I tried to make a copy but that didn't work, I could also do it with a pointer to Robot (&robot) but sometimes it just crashes ?
I tried this in my View.h @interface definition:
@property (copy) Robot* robot;
but I get the error
/RobotsAdventure/Classes/View.h:24: error: setter '-robot' argument type does not match property type
:/
Help? I'm pretty new at this, heh.