Commit ccf0fd650548e1ffdad625796069c430a116e780
1 parent
6adfd11c
no message
Showing
9 changed files
with
87 additions
and
86 deletions
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageCell.h renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingCell.h
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageCell.h | 2 | +// CNLiveFontSettingCell.h |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| @@ -8,11 +8,11 @@ | @@ -8,11 +8,11 @@ | ||
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | ||
| 11 | -@class CNLiveMessageFrame; | 11 | +@class CNLiveFontSettingFrame; |
| 12 | 12 | ||
| 13 | -@interface CNLiveMessageCell : UITableViewCell | 13 | +@interface CNLiveFontSettingCell : UITableViewCell |
| 14 | 14 | ||
| 15 | -@property (nonatomic, strong) CNLiveMessageFrame *messageFrame; | 15 | +@property (nonatomic, strong) CNLiveFontSettingFrame *fontSettingFrame; |
| 16 | 16 | ||
| 17 | @end | 17 | @end |
| 18 | 18 |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageCell.m renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingCell.m
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageCell.m | 2 | +// CNLiveFontSettingCell.m |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| 6 | // Copyright © 2018年 cnlive. All rights reserved. | 6 | // Copyright © 2018年 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "CNLiveMessageCell.h" | ||
| 10 | -#import "CNLiveMessageModel.h" | ||
| 11 | -#import "CNLiveMessageFrame.h" | 9 | +#import "CNLiveFontSettingCell.h" |
| 10 | +#import "CNLiveFontSettingModel.h" | ||
| 11 | +#import "CNLiveFontSettingFrame.h" | ||
| 12 | #import "CNLiveBaseKit.h" | 12 | #import "CNLiveBaseKit.h" |
| 13 | -#import "CNLiveMessageContentButton.h" | 13 | +#import "CNLiveFontSettingContentButton.h" |
| 14 | 14 | ||
| 15 | -@interface CNLiveMessageCell() | 15 | +@interface CNLiveFontSettingCell() |
| 16 | @property (nonatomic, strong) UIButton *btnHeadImage;//头像 | 16 | @property (nonatomic, strong) UIButton *btnHeadImage;//头像 |
| 17 | -@property (nonatomic, strong) CNLiveMessageContentButton *btnContent;//显示内容 | 17 | +@property (nonatomic, strong) CNLiveFontSettingContentButton *btnContent;//显示内容 |
| 18 | 18 | ||
| 19 | @end | 19 | @end |
| 20 | 20 | ||
| 21 | -@implementation CNLiveMessageCell | 21 | +@implementation CNLiveFontSettingCell |
| 22 | 22 | ||
| 23 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | 23 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { |
| 24 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | 24 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; |
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | [_btnHeadImage setBackgroundImage:image forState:UIControlStateNormal]; | 33 | [_btnHeadImage setBackgroundImage:image forState:UIControlStateNormal]; |
| 34 | [self.contentView addSubview:self.btnHeadImage]; | 34 | [self.contentView addSubview:self.btnHeadImage]; |
| 35 | 35 | ||
| 36 | - self.btnContent = [[CNLiveMessageContentButton alloc]init]; | 36 | + self.btnContent = [[CNLiveFontSettingContentButton alloc]init]; |
| 37 | [self.contentView addSubview:self.btnContent]; | 37 | [self.contentView addSubview:self.btnContent]; |
| 38 | 38 | ||
| 39 | } | 39 | } |
| @@ -41,12 +41,12 @@ | @@ -41,12 +41,12 @@ | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | #pragma mark - 内容及Frame设置 | 43 | #pragma mark - 内容及Frame设置 |
| 44 | -- (void)setMessageFrame:(CNLiveMessageFrame *)messageFrame{ | ||
| 45 | - _messageFrame = messageFrame; | 44 | +- (void)setFontSettingFrame:(CNLiveFontSettingFrame *)fontSettingFrame{ |
| 45 | + _fontSettingFrame = fontSettingFrame; | ||
| 46 | // 设置头像 | 46 | // 设置头像 |
| 47 | - self.btnHeadImage.frame = messageFrame.iconFrame; | 47 | + self.btnHeadImage.frame = fontSettingFrame.iconFrame; |
| 48 | // 4、设置内容 | 48 | // 4、设置内容 |
| 49 | - self.btnContent.messageFrame = messageFrame;//这里设置内容的frame等 | 49 | + self.btnContent.fontSettingFrame = fontSettingFrame;//这里设置内容的frame等 |
| 50 | 50 | ||
| 51 | } | 51 | } |
| 52 | 52 |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageContentButton.h renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingContentButton.h
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageContentButton.h | 2 | +// CNLiveFontSettingContentButton.h |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| @@ -8,12 +8,10 @@ | @@ -8,12 +8,10 @@ | ||
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | ||
| 11 | -@class CNLiveMessageFrame; | 11 | +@class CNLiveFontSettingFrame; |
| 12 | 12 | ||
| 13 | -@interface CNLiveMessageContentButton : UIButton | 13 | +@interface CNLiveFontSettingContentButton : UIButton |
| 14 | 14 | ||
| 15 | -@property (nonatomic, strong) UILabel *content; | ||
| 16 | - | ||
| 17 | -@property (nonatomic, strong) CNLiveMessageFrame *messageFrame; | 15 | +@property (nonatomic, strong) CNLiveFontSettingFrame *fontSettingFrame; |
| 18 | 16 | ||
| 19 | @end | 17 | @end |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageContentButton.m renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingContentButton.m
| 1 | // | 1 | // |
| 2 | -// CNMessageContentButton.m | 2 | +// CNFontSettingContentButton.m |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| 6 | // Copyright © 2018年 cnlive. All rights reserved. | 6 | // Copyright © 2018年 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "CNLiveMessageContentButton.h" | 9 | +#import "CNLiveFontSettingContentButton.h" |
| 10 | #import "CNLiveBaseKit.h" | 10 | #import "CNLiveBaseKit.h" |
| 11 | -#import "CNLiveMessageFrame.h" | ||
| 12 | -#import "CNLiveMessageModel.h" | 11 | +#import "CNLiveFontSettingFrame.h" |
| 12 | +#import "CNLiveFontSettingModel.h" | ||
| 13 | 13 | ||
| 14 | -@interface CNLiveMessageContentButton() | 14 | +@interface CNLiveFontSettingContentButton() |
| 15 | +@property (nonatomic, strong) UILabel *content; | ||
| 15 | 16 | ||
| 16 | @end | 17 | @end |
| 17 | 18 | ||
| 18 | -@implementation CNLiveMessageContentButton | 19 | +@implementation CNLiveFontSettingContentButton |
| 19 | 20 | ||
| 20 | - (id)initWithFrame:(CGRect)frame { | 21 | - (id)initWithFrame:(CGRect)frame { |
| 21 | self = [super initWithFrame:frame]; | 22 | self = [super initWithFrame:frame]; |
| @@ -25,15 +26,15 @@ | @@ -25,15 +26,15 @@ | ||
| 25 | return self; | 26 | return self; |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | -- (void)setMessageFrame:(CNLiveMessageFrame *)messageFrame { | ||
| 29 | - _messageFrame = messageFrame; | ||
| 30 | - self.frame = messageFrame.contentFrame; | 29 | +- (void)setFontSettingFrame:(CNLiveFontSettingFrame *)fontSettingFrame { |
| 30 | + _fontSettingFrame = fontSettingFrame; | ||
| 31 | + self.frame = fontSettingFrame.contentFrame; | ||
| 31 | 32 | ||
| 32 | //背景气泡图 | 33 | //背景气泡图 |
| 33 | UIImage *normal; | 34 | UIImage *normal; |
| 34 | - CNLiveMessageModel *message = messageFrame.message; | 35 | + CNLiveFontSettingModel *FontSetting = fontSettingFrame.model; |
| 35 | 36 | ||
| 36 | - if ([message.fromMe isEqualToString:@"1"]) { | 37 | + if ([FontSetting.fromMe isEqualToString:@"1"]) { |
| 37 | normal = [self xw_getImageName:@"font_size_message_me" bundleName:@"CNLiveSettingModule" targetClass:[self class]]; | 38 | normal = [self xw_getImageName:@"font_size_message_me" bundleName:@"CNLiveSettingModule" targetClass:[self class]]; |
| 38 | normal = [normal stretchableImageWithLeftCapWidth:normal.size.width * 0.5 topCapHeight:normal.size.height * 0.9]; | 39 | normal = [normal stretchableImageWithLeftCapWidth:normal.size.width * 0.5 topCapHeight:normal.size.height * 0.9]; |
| 39 | } | 40 | } |
| @@ -45,7 +46,7 @@ | @@ -45,7 +46,7 @@ | ||
| 45 | [self setBackgroundImage:normal forState:UIControlStateNormal]; | 46 | [self setBackgroundImage:normal forState:UIControlStateNormal]; |
| 46 | 47 | ||
| 47 | // 我发出的消息 | 48 | // 我发出的消息 |
| 48 | - if ([message.fromMe isEqualToString:@"1"]){ | 49 | + if ([FontSetting.fromMe isEqualToString:@"1"]){ |
| 49 | // 是我的消息 | 50 | // 是我的消息 |
| 50 | self.content.textColor = [UIColor whiteColor]; | 51 | self.content.textColor = [UIColor whiteColor]; |
| 51 | self.content.frame = CGRectMake(ChatContentRight, 0, self.frame.size.width-ChatContentLeft-ChatContentRight, self.frame.size.height); | 52 | self.content.frame = CGRectMake(ChatContentRight, 0, self.frame.size.width-ChatContentLeft-ChatContentRight, self.frame.size.height); |
| @@ -56,11 +57,11 @@ | @@ -56,11 +57,11 @@ | ||
| 56 | 57 | ||
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:message.content]; | ||
| 60 | - [attributedString addAttribute:NSFontAttributeName value:UIFontCNMake(15) range:NSMakeRange(0, message.content.length)]; | 60 | + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:FontSetting.content]; |
| 61 | + [attributedString addAttribute:NSFontAttributeName value:UIFontCNMake(15) range:NSMakeRange(0, FontSetting.content.length)]; | ||
| 61 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; | 62 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; |
| 62 | - [paragraphStyle setLineSpacing:ChatLineSpacing]; | ||
| 63 | - [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, message.content.length)]; | 63 | + [paragraphStyle setLineSpacing:ChatContentLineSpacing]; |
| 64 | + [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, FontSetting.content.length)]; | ||
| 64 | self.content.attributedText = attributedString; | 65 | self.content.attributedText = attributedString; |
| 65 | 66 | ||
| 66 | } | 67 | } |
CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingController.m
| @@ -12,9 +12,9 @@ | @@ -12,9 +12,9 @@ | ||
| 12 | #import "CNLiveBaseKit.h" | 12 | #import "CNLiveBaseKit.h" |
| 13 | 13 | ||
| 14 | #import "CNLiveSettingNavigationBar.h" | 14 | #import "CNLiveSettingNavigationBar.h" |
| 15 | -#import "CNLiveMessageFrame.h" | ||
| 16 | -#import "CNLiveMessageModel.h" | ||
| 17 | -#import "CNLiveMessageCell.h" | 15 | +#import "CNLiveFontSettingFrame.h" |
| 16 | +#import "CNLiveFontSettingModel.h" | ||
| 17 | +#import "CNLiveFontSettingCell.h" | ||
| 18 | 18 | ||
| 19 | @interface CNLiveFontSettingController ()<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> | 19 | @interface CNLiveFontSettingController ()<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> |
| 20 | @property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | 20 | @property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; |
| @@ -30,26 +30,26 @@ | @@ -30,26 +30,26 @@ | ||
| 30 | NSInteger tempCoefficient; | 30 | NSInteger tempCoefficient; |
| 31 | } | 31 | } |
| 32 | - (void)setupDataSource{ | 32 | - (void)setupDataSource{ |
| 33 | - CNLiveMessageFrame * frame1 = [[CNLiveMessageFrame alloc]init]; | ||
| 34 | - CNLiveMessageModel * message1 = [[CNLiveMessageModel alloc]init]; | ||
| 35 | - message1.content = @"预览字体大小"; | ||
| 36 | - message1.fromMe = @"1"; | ||
| 37 | - frame1.message = message1; | 33 | + CNLiveFontSettingFrame * frame1 = [[CNLiveFontSettingFrame alloc]init]; |
| 34 | + CNLiveFontSettingModel * FontSetting1 = [[CNLiveFontSettingModel alloc]init]; | ||
| 35 | + FontSetting1.content = @"预览字体大小"; | ||
| 36 | + FontSetting1.fromMe = @"1"; | ||
| 37 | + frame1.model = FontSetting1; | ||
| 38 | [self.data addObject:frame1]; | 38 | [self.data addObject:frame1]; |
| 39 | 39 | ||
| 40 | - CNLiveMessageFrame * frame2 = [[CNLiveMessageFrame alloc]init]; | ||
| 41 | - CNLiveMessageModel * message2 = [[CNLiveMessageModel alloc]init]; | ||
| 42 | - message2.content = @"拖拽下面的滑块,可设置字体大小"; | ||
| 43 | - message2.fromMe = @"0"; | ||
| 44 | - frame2.message = message2; | 40 | + CNLiveFontSettingFrame * frame2 = [[CNLiveFontSettingFrame alloc]init]; |
| 41 | + CNLiveFontSettingModel * FontSetting2 = [[CNLiveFontSettingModel alloc]init]; | ||
| 42 | + FontSetting2.content = @"拖拽下面的滑块,可设置字体大小"; | ||
| 43 | + FontSetting2.fromMe = @"0"; | ||
| 44 | + frame2.model = FontSetting2; | ||
| 45 | 45 | ||
| 46 | [self.data addObject:frame2]; | 46 | [self.data addObject:frame2]; |
| 47 | 47 | ||
| 48 | - CNLiveMessageFrame * frame3 = [[CNLiveMessageFrame alloc]init]; | ||
| 49 | - CNLiveMessageModel * message3 = [[CNLiveMessageModel alloc]init]; | ||
| 50 | - message3.content = [NSString stringWithFormat:@"设置后,可改变聊天、菜单中的字体大小。如果在使用过程中存在问题或意见,可反馈给%@",@"网家家"]; | ||
| 51 | - message3.fromMe = @"0"; | ||
| 52 | - frame3.message = message3; | 48 | + CNLiveFontSettingFrame * frame3 = [[CNLiveFontSettingFrame alloc]init]; |
| 49 | + CNLiveFontSettingModel * FontSetting3 = [[CNLiveFontSettingModel alloc]init]; | ||
| 50 | + FontSetting3.content = [NSString stringWithFormat:@"设置后,可改变聊天、菜单中的字体大小。如果在使用过程中存在问题或意见,可反馈给%@",@"网家家"]; | ||
| 51 | + FontSetting3.fromMe = @"0"; | ||
| 52 | + frame3.model = FontSetting3; | ||
| 53 | 53 | ||
| 54 | [self.data addObject:frame3]; | 54 | [self.data addObject:frame3]; |
| 55 | } | 55 | } |
| @@ -151,18 +151,18 @@ | @@ -151,18 +151,18 @@ | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | 153 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ |
| 154 | - CNLiveMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CNLiveMessageCell"]; | 154 | + CNLiveFontSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CNLiveFontSettingCell"]; |
| 155 | if (cell == nil) { | 155 | if (cell == nil) { |
| 156 | - cell = [[CNLiveMessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CNLiveMessageCell"]; | 156 | + cell = [[CNLiveFontSettingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CNLiveFontSettingCell"]; |
| 157 | } | 157 | } |
| 158 | - CNLiveMessageFrame *messageFrame = self.data[indexPath.row]; | ||
| 159 | - cell.messageFrame = messageFrame; | 158 | + CNLiveFontSettingFrame *fontSettingFrame = self.data[indexPath.row]; |
| 159 | + cell.fontSettingFrame = fontSettingFrame; | ||
| 160 | return cell; | 160 | return cell; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | 163 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 164 | - CNLiveMessageFrame *messageFrame = self.data[indexPath.row]; | ||
| 165 | - return messageFrame.cellHeight; | 164 | + CNLiveFontSettingFrame *FontSettingFrame = self.data[indexPath.row]; |
| 165 | + return FontSettingFrame.cellHeight; | ||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | #pragma mark - CNLiveSettingNavigationBarDelegate | 168 | #pragma mark - CNLiveSettingNavigationBarDelegate |
| @@ -252,9 +252,10 @@ | @@ -252,9 +252,10 @@ | ||
| 252 | 252 | ||
| 253 | - (void)setFontCoefficient:(NSInteger)coefficient{ | 253 | - (void)setFontCoefficient:(NSInteger)coefficient{ |
| 254 | [CNFontAndRatioTool setFontSizeCoefficient:coefficient]; | 254 | [CNFontAndRatioTool setFontSizeCoefficient:coefficient]; |
| 255 | - for (CNLiveMessageFrame * frame in self.data) { | ||
| 256 | - frame.message.content = frame.message.content; | ||
| 257 | - [frame setMessage:frame.message]; | 255 | + for (CNLiveFontSettingFrame * frame in self.data) { |
| 256 | + frame.model.content = frame.model.content; | ||
| 257 | +// [frame setFontSetting:frame.FontSetting]; | ||
| 258 | + [frame setModel:frame.model]; | ||
| 258 | } | 259 | } |
| 259 | [self.tableView reloadData]; | 260 | [self.tableView reloadData]; |
| 260 | 261 |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageFrame.h renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingFrame.h
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageFrame.h | 2 | +// CNLiveFontSettingFrame.h |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | #define ChatMargin 10 //间隔 | 8 | #define ChatMargin 10 //间隔 |
| 9 | #define ChatIconWH 45 //头像宽高height、width | 9 | #define ChatIconWH 45 //头像宽高height、width |
| 10 | 10 | ||
| 11 | -#define ChatLineSpacing 3 | 11 | +#define ChatContentLineSpacing 3 |
| 12 | 12 | ||
| 13 | #define ChatContentTop 18 | 13 | #define ChatContentTop 18 |
| 14 | #define ChatContentBottom 8 | 14 | #define ChatContentBottom 8 |
| @@ -18,14 +18,14 @@ | @@ -18,14 +18,14 @@ | ||
| 18 | 18 | ||
| 19 | #import <Foundation/Foundation.h> | 19 | #import <Foundation/Foundation.h> |
| 20 | 20 | ||
| 21 | -@class CNLiveMessageModel; | 21 | +@class CNLiveFontSettingModel; |
| 22 | 22 | ||
| 23 | -@interface CNLiveMessageFrame : NSObject | 23 | +@interface CNLiveFontSettingFrame : NSObject |
| 24 | 24 | ||
| 25 | @property (nonatomic, assign) CGRect iconFrame; // 头像frame | 25 | @property (nonatomic, assign) CGRect iconFrame; // 头像frame |
| 26 | @property (nonatomic, assign) CGRect contentFrame; // 内容frame | 26 | @property (nonatomic, assign) CGRect contentFrame; // 内容frame |
| 27 | @property (nonatomic, assign) CGFloat cellHeight; //cell 的高度 | 27 | @property (nonatomic, assign) CGFloat cellHeight; //cell 的高度 |
| 28 | 28 | ||
| 29 | -@property (nonatomic, strong) CNLiveMessageModel *message; | 29 | +@property (nonatomic, strong) CNLiveFontSettingModel *model; |
| 30 | 30 | ||
| 31 | @end | 31 | @end |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageFrame.m renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingFrame.m
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageFrame.m | 2 | +// CNLiveFontSettingFrame.m |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| 6 | // Copyright © 2018年 cnlive. All rights reserved. | 6 | // Copyright © 2018年 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "CNLiveMessageFrame.h" | ||
| 10 | -#import "CNLiveMessageModel.h" | 9 | +#import "CNLiveFontSettingFrame.h" |
| 11 | #import "QMUIKit.h" | 10 | #import "QMUIKit.h" |
| 12 | #import "CNLiveBaseKit.h" | 11 | #import "CNLiveBaseKit.h" |
| 13 | 12 | ||
| 14 | -@implementation CNLiveMessageFrame | 13 | +#import "CNLiveFontSettingModel.h" |
| 15 | 14 | ||
| 16 | -- (void)setMessage:(CNLiveMessageModel *)message{ | ||
| 17 | - _message = message; | 15 | +@implementation CNLiveFontSettingFrame |
| 16 | + | ||
| 17 | +- (void)setModel:(CNLiveFontSettingModel *)model{ | ||
| 18 | + _model = model; | ||
| 18 | // 1.计算头像位置 | 19 | // 1.计算头像位置 |
| 19 | CGFloat iconX = ChatMargin;//头像边距 | 20 | CGFloat iconX = ChatMargin;//头像边距 |
| 20 | - if ([_message.fromMe isEqualToString:@"1"]) { | 21 | + if ([_model.fromMe isEqualToString:@"1"]) { |
| 21 | iconX = SCREEN_WIDTH - ChatMargin - ChatIconWH;//头像坐标X | 22 | iconX = SCREEN_WIDTH - ChatMargin - ChatIconWH;//头像坐标X |
| 22 | } | 23 | } |
| 23 | CGFloat iconY = ChatContentTop;//头像坐标Y | 24 | CGFloat iconY = ChatContentTop;//头像坐标Y |
| @@ -30,10 +31,10 @@ | @@ -30,10 +31,10 @@ | ||
| 30 | 31 | ||
| 31 | CGSize maxSize = CGSizeMake(SCREEN_WIDTH-ChatIconWH*2-ChatMargin*2-(ChatContentLeft + ChatContentRight), CGFLOAT_MAX); | 32 | CGSize maxSize = CGSizeMake(SCREEN_WIDTH-ChatIconWH*2-ChatMargin*2-(ChatContentLeft + ChatContentRight), CGFLOAT_MAX); |
| 32 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; | 33 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; |
| 33 | - [paragraphStyle setLineSpacing:ChatLineSpacing]; | ||
| 34 | - CGSize contentSize = [_message.content boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:UIFontCNMake(15),NSParagraphStyleAttributeName:paragraphStyle} context:nil].size; | 34 | + [paragraphStyle setLineSpacing:ChatContentLineSpacing]; |
| 35 | + CGSize contentSize = [_model.content boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:UIFontCNMake(15),NSParagraphStyleAttributeName:paragraphStyle} context:nil].size; | ||
| 35 | 36 | ||
| 36 | - if ([_message.fromMe isEqualToString:@"1"]){ | 37 | + if ([_model.fromMe isEqualToString:@"1"]){ |
| 37 | contentX = iconX - contentSize.width - ChatContentLeft - ChatContentRight - ChatMargin; | 38 | contentX = iconX - contentSize.width - ChatContentLeft - ChatContentRight - ChatMargin; |
| 38 | } | 39 | } |
| 39 | CGFloat h = 0; | 40 | CGFloat h = 0; |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageModel.h renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingModel.h
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageModel.h | 2 | +// CNLiveFontSettingModel.h |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | 10 | ||
| 11 | -@interface CNLiveMessageModel :NSObject | 11 | +@interface CNLiveFontSettingModel :NSObject |
| 12 | @property (nonatomic, copy) NSString *fromMe; //是否自己发的 | 12 | @property (nonatomic, copy) NSString *fromMe; //是否自己发的 |
| 13 | @property (nonatomic, copy) NSString *content; //消息内容 | 13 | @property (nonatomic, copy) NSString *content; //消息内容 |
| 14 | 14 |
CNLiveSettingModule/Classes/FontSIze/CNLiveMessageModel.m renamed to CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingModel.m
| 1 | // | 1 | // |
| 2 | -// CNLiveMessageModel.m | 2 | +// CNLiveFontSettingModel.m |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by open on 2018/9/1. | 5 | // Created by open on 2018/9/1. |
| 6 | // Copyright © 2018年 cnlive. All rights reserved. | 6 | // Copyright © 2018年 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "CNLiveMessageModel.h" | 9 | +#import "CNLiveFontSettingModel.h" |
| 10 | 10 | ||
| 11 | -@implementation CNLiveMessageModel | 11 | +@implementation CNLiveFontSettingModel |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | @end | 14 | @end |