使用NS_ENUM 或者 NS_OPTIONS代替enum

使用NS_ENUM 或者 NS_OPTIONS代替enum

typedef NS_ENUM(NSInteger, UITableViewCellStyle) {
    	UITableViewCellStyleDefault,
    	UITableViewCellStyleValue1,
    	UITableViewCellStyleValue2,
    	UITableViewCellStyleSubtitle
};

typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) {
    	UIViewAutoresizingNone                 = 0,
    	UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
    	UIViewAutoresizingFlexibleWidth        = 1 << 1,
    	UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
    	UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
    	UIViewAutoresizingFlexibleHeight       = 1 << 4,
    	UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};

参考Next
Adopting Modern Objective-C

posted @ 2016-03-21 14:58  孙焱焱  阅读(528)  评论(0编辑  收藏  举报