位移枚举
C语言枚举定义
typedef enum
{
ActionEnumTop = 1 << 0 ,
//0 0 0 1
//0 0 0 1 =1(往左移动一位)
ActionEnumBottom = 1 << 1 ,
//0 0 0 1
//0 0 1 0 =2(往左移动一位)
ActionEnumLeft = 1 << 2 ,
ActionEnumRight = 1 << 3 ,
}ActionEnum;
苹果创建枚举的定义方式
typedef NS_OPTIONS(NSInteger, ActionEnum){
ActionEnumTop = 1 << 0 ,
ActionEnumBottom = 1 << 1 ,
ActionEnumLeft = 1 << 2 ,
ActionEnumRight = 1 << 3 ,
};