views:

11

answers:

1

Hoping someone can help me with this as I've done some scratching & searching I'm still overlooking something obvious... I've defined a simple enumerated data type:

typedef enum {
    kLow = -1,
    kMid,
    kHigh
} MyMode;

And made an instance variable of this type in my ClassA:

@interface ClassA : UIView {
    MyMode myMode;
}
@property (nonatomic) MyMode myMode;
@end

And then myMode is synthesized in the @implementation. Now in another class I reference ClassA

@interface ClassB : UIView {
    ClassA *classA;
}
@property (nonatomic, retain) ClassA *classA;
@end

Finally, in a method w/in ClassB I'd like to test for the state of ClassA's myMode property. I've tried

if (classA.myMode == kLow)

and this gives me the "request for member in something not a structure or a union" error. Casting didn't make a difference.

if ([classA myMode] == kLow)

gives me a "No '-myMode' method found".

I believe my headers and includes are correct.

+1  A: 

You need the @interface for ClassA before you can refer to ClassA's properties. Typically, this means you need to #import "ClassA.h" in ClassB.m, before ClassB's @implementation.

Peter Hosey
I'm a dumbass. I had the @class ClassA; declaration in the @interface...but forgot the import in @implementation..and put it out of my mind... garr! well, thx!
Meltemi