Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

blue-lion

macrumors member
Original poster
Jan 26, 2010
50
0
Hello, i am having problems with the synthesize/property statement.

In the header i write

@property int fillColor;


and in the implementation file i write

@synthesize fillColor;

I've read that setter methods are created this way so,when i use the function below, it should work...right?

[object1 setfillColor 2] ;

I get a message saying "[GraphicObject fillColor:]: unrecognized selector sent to instance 0x10010c6d0"

GraphicObject is my class.



obviously i've omitted all the commands from the headers/footers for clarity.



can anybody help?
 
Reread the reference docs on properties, paying particular attention to the capitalization algorithm for mapping property names onto method names.
 
I've read that setter methods are created this way so,when i use the function below, it should work...right?

[object1 setfillColor 2] ;

First off, the basic syntax is off:

[object1 setfillColor:2] ; --- notice the colon

And I believe it would actually be:

[object1 setFillColor:2] ; --- capitalization.

That's the pretty standard notation with auto-created/called getters and setters
 
Capitalize?

I've read that setter methods are created this way so,when i use the function below, it should work...right?

[object1 setfillColor 2] ;



can anybody help?

I'm not at my Mac right now, but off the top of my head you may want to capitalize the "F" in setFillColor.
 
I get a message saying "[GraphicObject fillColor:]: unrecognized selector sent to instance 0x10010c6d0"

GraphicObject is my class.



obviously i've omitted all the commands from the headers/footers for clarity.



can anybody help?

What they said. But your specific error is not a setter, but a getter. There should be no : after that selector.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.