Reputation: 10039
I am a complete newbie at Objective-C. I have an enum as follows:
typedef enum _XLBadgeManagedType {
XLInboxManagedMethod = 0,
XLDeveloperManagedMethod = 1
} XLBadgeManagedType ;
I want to have getter and setter methods for it, such that if something happens, I set XLInboxManagedMethod
to 1. How would I go about doing it?
Upvotes: 1
Views: 6481
Reputation: 25692
They are symbolic constants. You can not change it.
Upvotes: 0
Reputation: 20163
Your code is just defining an enum type. It's a static, compile-time constant that is not changed. You use enums by declaring an instance of one, then changing it to one of the constant values you defined. If your enum looks like:
typedef enum _XLBadgeManagedType {
XLInboxManagedMethod = 0,
XLDeveloperManagedMethod = 1
} XLBadgeManagedType;
Then your property could look like:
@property (nonatomic, assign) XLBadgeManagedType myEnum;
And its use may look like:
- (void)someMethod {
self.myEnum = XLInboxManagedMethod;
self.myEnum = XLDeveloperManagedMethod;
// etc...
}
Upvotes: 14