NS_ENUM
通用枚举值
typedef NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) {
UIControlContentHorizontalAlignmentCenter = 0,
UIControlContentHorizontalAlignmentLeft = 1,
UIControlContentHorizontalAlignmentRight = 2,
UIControlContentHorizontalAlignmentFill = 3,
};
NS_OPTIONS
位移相关操作的枚举值
typedef NS_OPTIONS(NSUInteger, UIControlState) {
UIControlStateNormal = 0,
UIControlStateHighlighted = 1 << 0,
UIControlStateDisabled = 1 << 1,
UIControlStateSelected = 1 << 2,
UIControlStateApplication = 0x00FF0000,
UIControlStateReserved = 0xFF000000
};
- 通常情况下我们用的枚举是NS_ENUM
- 当一个枚举变量可能要代表多个属性的时候,就要用到NS_OPTIONS(NS_OPTIONS代表的也是一个值,只不过是两个或多个值按位移后的值)
self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
共
同
进
步
给个喜欢喔O(∩_∩)O