Send copy of class to view class so it can render him? ( iPhone )
Posted
by Johannes Jensen
on Stack Overflow
See other posts from Stack Overflow
or by Johannes Jensen
Published on 2010-04-02T12:26:31Z
Indexed on
2010/04/02
12:33 UTC
Read the original article
Hit count: 218
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.
© Stack Overflow or respective owner