Beomseok
Beomseok

Reputation: 471

I don't know how to use typedef enum

typedef enum {
    kA = 0,
    kB,
    kC,
    kD,
    kE,
    kF
} index;

@interface myViewController : UITableViewController<UIAlertViewDelegate> {
    index enumIndex;
}

Hi, guys.

I declare index which is composed by typedef enum. But I didn't found code like that. and If that code useful, does not need to release ?

I don't understand typedef enum in Objective C.

Please help me.

Upvotes: 0

Views: 601

Answers (1)

bbum
bbum

Reputation: 162712

typedef enum works exactly the same in Objective-C as it does in C. There is no difference.

If I were to hazard a guess as to the compiler error that you didn't provide, I'd bet that index is already defined and it is complaining about redefinition. In any case, make your typedef comprehensible, say MyViewControllerIndex.

Note also that your class names should start with capital letters; MyViewController.

Upvotes: 1

Related Questions