|
@@ -556,11 +556,11 @@
|
|
|
|
|
|
|
|
//加vip
|
|
//加vip
|
|
|
if(rtmEntity.user.vip.type > 0){
|
|
if(rtmEntity.user.vip.type > 0){
|
|
|
- [self toAddVipInfoWith:plainText And:rtmEntity.user.vip.type];
|
|
|
|
|
|
|
+ [self toAddSmallVipInfoWith:plainText And:rtmEntity.user.vip.type AndHeight:14.0];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//加等级
|
|
//加等级
|
|
|
- [self toAddSmallLevelInfoWith:plainText And:rtmEntity.user.level];
|
|
|
|
|
|
|
+ [self toAddSmallLevelInfoWith:plainText And:rtmEntity.user.level AndHeight:14.0];
|
|
|
|
|
|
|
|
return plainText;
|
|
return plainText;
|
|
|
}
|
|
}
|
|
@@ -832,6 +832,61 @@
|
|
|
return contentStr;
|
|
return contentStr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
++ (NSMutableAttributedString *)toAddSmallVipInfoWith:(NSMutableAttributedString *)contentStr And:(NSInteger)vipType AndHeight:(CGFloat)viewHeight{
|
|
|
|
|
+
|
|
|
|
|
+ CGFloat theBaseViewHeight = 14;
|
|
|
|
|
+ if(viewHeight > 0){
|
|
|
|
|
+ theBaseViewHeight = viewHeight;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(vipType != 0){
|
|
|
|
|
+ //VIP 对象
|
|
|
|
|
+ MOBaseVips *vipObject = [[MOSvgaSourceManage shareManager] toGetTheVipObjectWith:vipType];
|
|
|
|
|
+ if(vipObject){
|
|
|
|
|
+ UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, theBaseViewHeight, theBaseViewHeight)];
|
|
|
|
|
+ bgView.backgroundColor = [UIColor clearColor];
|
|
|
|
|
+ YYAnimatedImageView *medalImg = [[YYAnimatedImageView alloc] init];
|
|
|
|
|
+ medalImg.frame = CGRectMake(0.0, 0.0, theBaseViewHeight, theBaseViewHeight);
|
|
|
|
|
+ medalImg.contentMode = UIViewContentModeScaleAspectFit;
|
|
|
|
|
+
|
|
|
|
|
+ NSString *urlStr = vipObject.thumbnail;
|
|
|
|
|
+ NSURL *url = [NSURL URLWithString:urlStr];
|
|
|
|
|
+ [medalImg setImageWithURL:url placeholder:nil];
|
|
|
|
|
+ [bgView addSubview:medalImg];
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableAttributedString *vipImgAttri = [NSMutableAttributedString attachmentStringWithContent:bgView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(theBaseViewHeight, theBaseViewHeight) alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
|
|
|
|
|
+ [vipImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
|
|
|
|
|
+ [contentStr insertAttributedString:[vipImgAttri copy] atIndex:0];
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ //旧版 VIP 静态图
|
|
|
|
|
+ UIImage *vipImg = [MOTextTools getVipIconWith:vipType];
|
|
|
|
|
+ NSTextAttachment *vipAttachment;
|
|
|
|
|
+ if(vipImg){
|
|
|
|
|
+ CGSize vipSize;
|
|
|
|
|
+ vipAttachment = [[NSTextAttachment alloc] init];
|
|
|
|
|
+ vipAttachment.image = vipImg;
|
|
|
|
|
+ //字体行高
|
|
|
|
|
+ UIFont *font = MOTextLabelFont;
|
|
|
|
|
+ CGFloat attachmentHeight = font.lineHeight;
|
|
|
|
|
+ CGFloat imgSizeHeight = GetParamNotZero(vipImg.size.height);
|
|
|
|
|
+ CGFloat attachmentWidth = attachmentHeight * vipImg.size.width/ imgSizeHeight;
|
|
|
|
|
+ vipAttachment.bounds = CGRectMake(0, (font.capHeight-font.lineHeight)/2, attachmentWidth, attachmentHeight);
|
|
|
|
|
+ vipSize = CGSizeMake(attachmentWidth, attachmentHeight);
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableAttributedString *vipImgAttri = [NSMutableAttributedString attachmentStringWithContent:vipImg contentMode:UIViewContentModeScaleAspectFit attachmentSize:vipSize alignToFont:MOTextLabelFont alignment:YYTextVerticalAlignmentCenter];
|
|
|
|
|
+ //生成NSAttributedString
|
|
|
|
|
+ // NSMutableAttributedString *vipImgAttri = [[NSAttributedString attributedStringWithAttachment:vipAttachment] mutableCopy];
|
|
|
|
|
+
|
|
|
|
|
+ [vipImgAttri appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
|
|
|
|
|
+
|
|
|
|
|
+ [contentStr insertAttributedString:[vipImgAttri copy] atIndex:0];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return contentStr;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+ (NSMutableAttributedString *)toAddLevelInfoWith:(NSMutableAttributedString *)contentStr And:(NSInteger)levelNum{
|
|
+ (NSMutableAttributedString *)toAddLevelInfoWith:(NSMutableAttributedString *)contentStr And:(NSInteger)levelNum{
|
|
|
|
|
|
|
|
NSArray *levelInfoArr = [MOSvgaSourceManage shareManager].allLevelSoureArr;
|
|
NSArray *levelInfoArr = [MOSvgaSourceManage shareManager].allLevelSoureArr;
|
|
@@ -911,7 +966,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-+ (NSMutableAttributedString *)toAddSmallLevelInfoWith:(NSMutableAttributedString *)contentStr And:(NSInteger)levelNum{
|
|
|
|
|
|
|
++ (NSMutableAttributedString *)toAddSmallLevelInfoWith:(NSMutableAttributedString *)contentStr And:(NSInteger)levelNum AndHeight:(CGFloat)viewHeight{
|
|
|
|
|
|
|
|
NSArray *levelInfoArr = [MOSvgaSourceManage shareManager].allLevelSoureArr;
|
|
NSArray *levelInfoArr = [MOSvgaSourceManage shareManager].allLevelSoureArr;
|
|
|
MOStoreInfo *medalInfo;
|
|
MOStoreInfo *medalInfo;
|
|
@@ -923,12 +978,15 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
CGFloat levelHeight = 14.0;
|
|
CGFloat levelHeight = 14.0;
|
|
|
|
|
+ if(viewHeight > 0){
|
|
|
|
|
+ levelHeight = viewHeight;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if(medalInfo.res.length > 0){
|
|
if(medalInfo.res.length > 0){
|
|
|
|
|
|
|
|
//这里调整的话, 请同时调整 MOBaseLevelView
|
|
//这里调整的话, 请同时调整 MOBaseLevelView
|
|
|
CGFloat levelWidth = MOLevelNormalWidth;
|
|
CGFloat levelWidth = MOLevelNormalWidth;
|
|
|
- CGFloat levelLabelX = 14.0;
|
|
|
|
|
|
|
+ CGFloat levelLabelX = 13.0;
|
|
|
CGFloat levelLabexWidth = levelWidth - levelLabelX;
|
|
CGFloat levelLabexWidth = levelWidth - levelLabelX;
|
|
|
|
|
|
|
|
if(levelNum >= 100){
|
|
if(levelNum >= 100){
|
|
@@ -937,7 +995,7 @@
|
|
|
}
|
|
}
|
|
|
else if (levelNum < 10){
|
|
else if (levelNum < 10){
|
|
|
levelWidth = MOLevelMixWidth;
|
|
levelWidth = MOLevelMixWidth;
|
|
|
- levelLabelX = 13.0;
|
|
|
|
|
|
|
+ levelLabelX = 12.0;
|
|
|
levelLabexWidth = levelWidth - levelLabelX;
|
|
levelLabexWidth = levelWidth - levelLabelX;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -952,7 +1010,7 @@
|
|
|
[bgView addSubview:levelImg];
|
|
[bgView addSubview:levelImg];
|
|
|
|
|
|
|
|
UILabel *levelLabel = [[UILabel alloc] initWithFrame:CGRectMake(levelLabelX, 0, levelLabexWidth, levelHeight)];
|
|
UILabel *levelLabel = [[UILabel alloc] initWithFrame:CGRectMake(levelLabelX, 0, levelLabexWidth, levelHeight)];
|
|
|
- levelLabel.font = [MOTextTools poppinsExtraBoldFont:10.0];
|
|
|
|
|
|
|
+ levelLabel.font = [MOTextTools poppinsExtraBoldFont:8.0];
|
|
|
levelLabel.textColor = [UIColor whiteColor];
|
|
levelLabel.textColor = [UIColor whiteColor];
|
|
|
levelLabel.textAlignment = NSTextAlignmentCenter;
|
|
levelLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
levelLabel.text = [NSString stringWithFormat:@"%zd",levelNum];
|
|
levelLabel.text = [NSString stringWithFormat:@"%zd",levelNum];
|