Obj-C Error: Expected expression before ...... (why?)

Posted by Horatiu Paraschiv on Stack Overflow See other posts from Stack Overflow or by Horatiu Paraschiv
Published on 2010-04-07T17:46:46Z Indexed on 2010/04/07 17:53 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

Hi I have an enum declared like this:

typedef enum {
    Top,             
    Bottom,
    Center
} UIItemAlignment;

In my code I try to use it like this:

item.alignment = UIItemAlignment.Top;

I get an error like this: " Expected expression before 'UIItemAlignment' "

If I use only:

item.alignment = Top;

everything works fine but why do I get this error if I try to use it the other way?

_alignment is an NSInteger and it has a property declared like this

@property (readwrite) NSInteger alignment; and I synthesized it in my implementation file.

So my question is, why do I get this error?

© Stack Overflow or respective owner

Related posts about typedef

Related posts about enums