所以在我的旅行中,我总是看到枚举是这样定义的(当需要位图时)
enum {
UIControlStateNormal = 0,
UIControlStateHighlighted = 1 << 0, // used when UIControl isHighlighted is set
UIControlStateDisabled = 1 << 1,
UIControlStateSelected = 1 << 2, // flag usable by app (see below)
};
但是,我最近刚刚查看了 NSJSONSerilization 类,发现一个枚举定义为
enum {
NSJSONReadingMutableContainers = (1UL << 0),
NSJSONReadingMutableLeaves = (1UL << 1),
NSJSONReadingAllowFragments = (1UL << 2)
};
typedef NSUInteger NSJSONReadingOptions;
所以我想我的问题是做UL
什么。1 << 1
和有什么区别1UL << 1