Reputation: 36013
I have a property declared on a class:
.h
@interface myClass : UIView {
BOOL doStuff;
}
@property BOOL doStuff;
.m
@synthesize doStuff;
this class is a delegate of another one. On the other class, I am trying to set this property, doing something like
[delegate setDoStuff:YES];
I receive an error telling me that "method -setDoStuff: not found..."
How do I declare the property on the class, so other classes can read and set them?
thanks.
Upvotes: 0
Views: 144
Reputation: 2547
is your delegate declared as type "id" ?
either you declare its true type MyClass delegate in the other class (which points to your myclass) or
declare a protocol that delegate has to implement id in declaration.
Last (but not right approach) is to typecast it [(MyClass)delegate doStuff].
Upvotes: 2
Reputation: 31730
you could also specify the name of setter function in @property
.
@property (nonatomic,setter = setMyDoStuff,assign) BOOL doStuff;
Upvotes: 1
Reputation: 19071
Make sure that you’re importing your custom class’s header and that delegate
is declared as an instance of that class.
Upvotes: 1