views:

52

answers:

2

I wonder what is wrong with this?

.h file:

typedef enum {
    N4LoupeTypeRound,
    N4LoupeTypeRectangle,
} N4LoupeType;

@interface N4LoupeLayer : CALayer {
    N4LoupeType _type;
    UIView *_originalView;
    CALayer *_mask;
    CALayer *_overlay;
}

@property (nonatomic) N4LoupeType type;
@property (nonatomic, assign) UIView *originalView;

@end

.m file:

#import "N4LoupeLayer.h"

@interface N4LoupeLayer (Privates)

@property (nonatomic, retain) CALayer *mask;
@property (nonatomic, retain) CALayer *overlay;

@end

@implementation N4LoupeLayer

@synthesize type = _type;
@synthesize originalView = _originalView;
@synthesize mask = _mask;
@synthesize overlay = _overlay; // ******I GET THE ERROR HERE********* 

@end

No declaration of property 'overlay' found in the interface in N4LoupeLayer.m

+2  A: 

You defined the properties for the category Privates, but you are trying to synthesize them in N4LoupeLayer.

kiamlaluno
I just realized that I want a class extension and not a category. I should write @interface N4LoupeLayer () instead of @interface N4LoupeLayer (Privates) in the .m file.Even though, this is strange yet. why the error does not appear in _mask property?
nacho4d
When you don't use any categories, simply write `@interface N4LoupeLayer`. The reason of why you just see the error reported for `_overlay` is that probably the properties are handled in LIFO order.
kiamlaluno
+1  A: 

is this ok about the trailing ',' after lat member of the enum?

typedef enum {
    N4LoupeTypeRound,
    N4LoupeTypeRectangle,
} N4LoupeType;

I have got no other problems, since i havent use enum yet :(

Sadat
This syntactic quirk is strangely allowed in C. I could only guess to allow easy line based copy-paste re-ordering of enums.
Akusete
This seems to be ok. I tried deleting the last "," and the error didn't go away.
nacho4d