Isn't it C?Yes, it is C, so the way you use C's enumeration definition is OK. As follows:
Typedef enum {TypeA = 0, TypeB, TypeC, TypeD} MyType;
MyType is the name of the enumeration type. The possible values are TypeA, TypeB, TypeC, and TypeD. The value of TypeA is 0, followed by 1, 2, and 3.
What is the unique method of iOS?Typedef NS_ENUM (NSInteger, MyType) {TypeA = 1, TypeB = 2, TypeC = 3, TypeD = 4 };
NS_ENUM is used to define enumeration, NSInteger is the enumerated value, and MyType is the name of the enumeration class.
Common bit notationTypedef NS_ENUM (uint, Test) {TestA = 1, TestB = 1 <1, TestC = 1 <2, TestD = 1 <3, testE = 1 <4 };
Multiple values can be obtained for enumeration instances.For example, the preceding example includes Test:
Test t = TestA | TestB | TestC;
Reprinted please indicate the blog from laruence: http://prevention.iteye.com