所以在我的旅行中,我看到enums的定义是这样的(当需要一个位图时)
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之间的区别是什么? 1和1UL<< 1