OC 创建枚举,创建单例,文本中划线(富文本)

来源:互联网 发布:上古卷轴5故事知乎 编辑:程序博客网 时间:2024/05/17 06:47
//NS_ENUM,定义状态等普通枚举typedef NS_ENUM(NSUInteger, TTGState) {TTGStateOK = 0,TTGStateError,TTGStateUnknow};//NS_OPTIONS,定义选项typedef NS_OPTIONS(NSUInteger, TTGDirection) {TTGDirectionNone = 0,TTGDirectionTop = 1 << 0,TTGDirectionLeft = 1 << 1,TTGDirectionRight = 1 << 2,TTGDirectionBottom = 1 << 3};
//创建单例+(id)shareInstance{     static dispatch_once_t onceToken;      dispatch_once(&onceToken, ^{      if(_instance == nil)             _instance = [MyClass alloc] init];     });     return _instance;}
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"¥%@", goodsModel.originPrice]];    [attrStr addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, attrStr.length)];    self.originalPriceLB.attributedText = attrStr;
0 0
原创粉丝点击