|
|
@@ -42,19 +42,21 @@
|
|
|
|
|
|
[self.bgView addSubview:self.bubbleImgView];
|
|
|
[self.bubbleImgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(self.bgView).offset(-MOBgViewOffSet);
|
|
|
- make.right.equalTo(self.bgView).offset(MOBgViewOffSet);
|
|
|
- make.top.equalTo(self.bgView).offset(-MOBgViewOffSet);
|
|
|
- make.bottom.equalTo(self.bgView).offset(MOBgViewOffSet);
|
|
|
+ make.left.equalTo(self.bgView).offset(-0.0);
|
|
|
+ make.right.equalTo(self.bgView).offset(0.0);
|
|
|
+ make.top.equalTo(self.bgView).offset(-0.0);
|
|
|
+ make.bottom.equalTo(self.bgView).offset(0.0);
|
|
|
|
|
|
}];
|
|
|
+ self.bubbleImgView.layer.cornerRadius = 14.0;
|
|
|
+ self.bubbleImgView.layer.masksToBounds = YES;
|
|
|
|
|
|
[self.bgView addSubview:self.contentTextView];
|
|
|
[self.contentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(self.bgView).offset(MOContentLeftAndRighSpacing);
|
|
|
- make.right.equalTo(self.bgView).offset(-MOContentLeftAndRighSpacing);
|
|
|
- make.centerY.equalTo(self.bgView);
|
|
|
- make.height.equalTo(@16.0);
|
|
|
+ make.left.equalTo(self.redTagImgView.mas_right).offset(2.0);
|
|
|
+ make.right.equalTo(self.bgView).offset(-2.0);
|
|
|
+ make.top.equalTo(self.bgView).offset(5.0);
|
|
|
+ make.bottom.equalTo(self.bgView);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
@@ -72,10 +74,53 @@
|
|
|
- (void)setCellModel:(MORtmEntity *)cellModel{
|
|
|
_cellModel = cellModel;
|
|
|
|
|
|
- NSMutableAttributedString *attributedString = [MOTextTools creteTextWith:cellModel];
|
|
|
+ MORtmJosnEntity *jsonEntity = (MORtmJosnEntity *)cellModel.data;
|
|
|
+ NSString *userName = jsonEntity.activitySuperLucky2.user.username;
|
|
|
+
|
|
|
+ NSString *luckyTipStr = @"Super Lucky Jackpot";
|
|
|
+ NSString *redRainTipStr = @"Red Envelope Rain";
|
|
|
+
|
|
|
+ NSString *endText = [NSString stringWithFormat:@"%@ Win %@ %@ is coming...",userName,luckyTipStr,redRainTipStr];
|
|
|
+
|
|
|
+ NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:endText attributes:@{NSForegroundColorAttributeName:[MOTools colorWithHexString:@"#FFFFFF" alpha:1.0]}];
|
|
|
+
|
|
|
+ [self base_yellow_colorfulStringWith:endText AndNameStr:userName And:attributedString];
|
|
|
+ [self base_blue_colorfulStringWith:endText AndNameStr:luckyTipStr And:attributedString];
|
|
|
+ [self base_yellow_colorfulStringWith:endText AndNameStr:redRainTipStr And:attributedString];
|
|
|
+
|
|
|
+ // 设置字体大小的属性
|
|
|
+ [attributedString addAttribute:NSFontAttributeName value:[MOTextTools getTheFontWithSize:12.0 AndFontName:@"Akrobat"] range:NSMakeRange(0, endText.length)];
|
|
|
+
|
|
|
self.contentTextView.attributedText = attributedString;
|
|
|
|
|
|
+}
|
|
|
+
|
|
|
+- (NSMutableAttributedString *)base_yellow_colorfulStringWith:(NSString *)contentStr AndNameStr:(NSString *)nameStr And:(NSMutableAttributedString *)attributedString {
|
|
|
+
|
|
|
+ // 创建属性字符串,整体颜色为白色
|
|
|
+ if(nameStr.length != 0){
|
|
|
+ NSRange redRange = [contentStr rangeOfString:nameStr];
|
|
|
+ if(redRange.location != NSNotFound){
|
|
|
+ // 将最后三个字符的颜色设置为红色
|
|
|
+ [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FFF391" alpha:1.0] range:redRange];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return attributedString;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSMutableAttributedString *)base_blue_colorfulStringWith:(NSString *)contentStr AndNameStr:(NSString *)nameStr And:(NSMutableAttributedString *)attributedString {
|
|
|
+
|
|
|
+ // 创建属性字符串,整体颜色为白色
|
|
|
+ if(nameStr.length != 0){
|
|
|
+ NSRange redRange = [contentStr rangeOfString:nameStr];
|
|
|
+ if(redRange.location != NSNotFound){
|
|
|
+ // 将最后三个字符的颜色设置为红色
|
|
|
+ [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#67EBFF" alpha:1.0] range:redRange];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ return attributedString;
|
|
|
}
|
|
|
|
|
|
#pragma mark - Lazy
|
|
|
@@ -84,7 +129,7 @@
|
|
|
if (_bgView == nil)
|
|
|
{
|
|
|
_bgView = [UIView new];
|
|
|
- _bgView.backgroundColor = MONormalBgViewColor;
|
|
|
+ _bgView.backgroundColor = [UIColor clearColor];
|
|
|
}
|
|
|
return _bgView;
|
|
|
}
|