修复了动态的若干个bug

This commit is contained in:
fengshuo
2022-08-31 18:27:27 +08:00
parent 10c410f3ff
commit b3916b47e9
7 changed files with 29 additions and 25 deletions

View File

@@ -14,20 +14,22 @@
{ {
QInputBarViewConfiguration *configuration = [QInputBarViewConfiguration new]; QInputBarViewConfiguration *configuration = [QInputBarViewConfiguration new];
if (@available(iOS 11.0, *)) { // if (@available(iOS 11.0, *)) {
NSBundle *bundle = [NSBundle bundleForClass:[QInputBarViewConfiguration class]]; // NSBundle *bundle = [NSBundle bundleForClass:[QInputBarViewConfiguration class]];
configuration.inputBarBackgroundColor = [UIColor colorNamed:@"q_input_gray_bg" inBundle:bundle compatibleWithTraitCollection:nil]; //// configuration.inputBarBackgroundColor = [UIColor colorNamed:@"q_input_gray_bg" inBundle:bundle compatibleWithTraitCollection:nil];
configuration.inputBarBoardColor = [UIColor colorNamed:@"q_border223" inBundle:bundle compatibleWithTraitCollection:nil]; // configuration.inputBarBoardColor = [UIColor colorNamed:@"q_border223" inBundle:bundle compatibleWithTraitCollection:nil];
configuration.textColor = [UIColor colorNamed:@"q_black_gray" inBundle:bundle compatibleWithTraitCollection:nil]; //// configuration.textColor = [UIColor colorNamed:@"q_black_gray" inBundle:bundle compatibleWithTraitCollection:nil];
configuration.textViewBackgroundColor = [UIColor colorNamed:@"q_input" inBundle:bundle compatibleWithTraitCollection:nil]; // configuration.textViewBackgroundColor = [UIColor colorNamed:@"q_input" inBundle:bundle compatibleWithTraitCollection:nil];
configuration.recordButtonTitleColor = [UIColor colorNamed:@"q_black_white" inBundle:bundle compatibleWithTraitCollection:nil]; // configuration.recordButtonTitleColor = [UIColor colorNamed:@"q_black_white" inBundle:bundle compatibleWithTraitCollection:nil];
} else { // } else {
configuration.inputBarBackgroundColor = [UIColor colorWithRed:242/255.0f green:242/255.0f blue:242/255.0f alpha:1]; //
configuration.inputBarBoardColor = [UIColor colorWithRed:223/255.0f green:223/255.0f blue:223/255.0f alpha:1]; //
configuration.textColor = [UIColor blackColor]; // }
configuration.textViewBackgroundColor = [UIColor whiteColor]; configuration.inputBarBoardColor = [UIColor clearColor];
configuration.recordButtonTitleColor = [UIColor darkGrayColor]; configuration.textColor = [UIColor blackColor];
} configuration.recordButtonTitleColor = [UIColor darkGrayColor];
configuration.inputBarBackgroundColor = [UIColor colorWithRed:242/255.0f green:242/255.0f blue:242/255.0f alpha:1];
configuration.textViewBackgroundColor = [UIColor whiteColor];
configuration.inputBarHeightChangeAnimationDuration = 0.2; configuration.inputBarHeightChangeAnimationDuration = 0.2;
configuration.keyboardSendEnabled = YES; configuration.keyboardSendEnabled = YES;
configuration.inputBarHeightChangeAnimationDuration = 0.2; configuration.inputBarHeightChangeAnimationDuration = 0.2;

View File

@@ -24,7 +24,7 @@
/// ///
rowHeight += [self monentsPicHeight:monents]; rowHeight += [self monentsPicHeight:monents];
/// ///
if (monents.type == MonentsContentType_Picture) { if (monents.type == MonentsContentType_Picture && monents.content.length > 0) {
rowHeight += (kMONENTS_CONTENT_SPACAE_HEIGHT * 2); rowHeight += (kMONENTS_CONTENT_SPACAE_HEIGHT * 2);
}else { }else {
rowHeight += kMONENTS_CONTENT_SPACAE_HEIGHT; rowHeight += kMONENTS_CONTENT_SPACAE_HEIGHT;
@@ -37,9 +37,6 @@
} }
+ (CGFloat)monentsPicHeight:(MonentsInfoModel *)monents { + (CGFloat)monentsPicHeight:(MonentsInfoModel *)monents {
if (monents.type == MonentsContentType_Picture) {
}
/// ///
NSInteger picCount = monents.dynamicResList.count; NSInteger picCount = monents.dynamicResList.count;
CGFloat picHeight = 0; CGFloat picHeight = 0;
@@ -85,6 +82,7 @@
} }
[attributedString appendAttributedString:[self creatStrAttrByStr:monents.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]]; [attributedString appendAttributedString:[self creatStrAttrByStr:monents.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
attributedString.yy_lineSpacing = 5; attributedString.yy_lineSpacing = 5;
attributedString.yy_lineBreakMode = NSLineBreakByWordWrapping;
monents.contentAttribute = attributedString; monents.contentAttribute = attributedString;
} }
@@ -100,7 +98,7 @@
container.maximumNumberOfRows = numberOfLines; container.maximumNumberOfRows = numberOfLines;
} }
YYTextLayout *realLayout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute]; YYTextLayout *realLayout = [YYTextLayout layoutWithContainer:container text:monents.contentAttribute];
CGFloat contentHeight = realLayout.textBoundingSize.height + 15; CGFloat contentHeight = realLayout.textBoundingSize.height;
monents.contentHeight =contentHeight; monents.contentHeight =contentHeight;
return contentHeight + foldHeight; return contentHeight + foldHeight;
} }

View File

@@ -28,6 +28,7 @@
} }
#pragma mark - Private Method #pragma mark - Private Method
- (void)initSubViews { - (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone; self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyImageView]; [self.contentView addSubview:self.emptyImageView];
[self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.titleLabel];

View File

@@ -185,13 +185,13 @@
make.height.mas_equalTo(picHeight); make.height.mas_equalTo(picHeight);
}]; }];
} else { } else {
self.photoView.hidden = NO; self.photoView.hidden = YES;
[self.photoView mas_updateConstraints:^(MASConstraintMaker *make) { [self.photoView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0); make.height.mas_equalTo(0);
}]; }];
} }
CGFloat contentHeight = _monentsInfo.contentHeight <=0 ? [XPMonentsLayoutConfig monentsContentHeight:_monentsInfo] : _monentsInfo.contentHeight; CGFloat contentHeight = [XPMonentsLayoutConfig monentsContentHeight:_monentsInfo];
[self.textView mas_updateConstraints:^(MASConstraintMaker *make) { [self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(contentHeight); make.height.mas_equalTo(contentHeight);
}]; }];

View File

@@ -99,7 +99,7 @@
_topicImageView.userInteractionEnabled = YES; _topicImageView.userInteractionEnabled = YES;
_topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)]; _topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
_topicImageView.layer.masksToBounds = YES; _topicImageView.layer.masksToBounds = YES;
_topicImageView.layer.cornerRadius = 13; _topicImageView.layer.cornerRadius = 8;
} }
return _topicImageView; return _topicImageView;
} }

View File

@@ -66,6 +66,7 @@
} }
[attributedString appendAttributedString:[self creatStrAttrByStr:self.monentsInfo.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]]; [attributedString appendAttributedString:[self creatStrAttrByStr:self.monentsInfo.content attributed:@{NSFontAttributeName : [UIFont systemFontOfSize:15]}]];
attributedString.yy_lineSpacing = 5; attributedString.yy_lineSpacing = 5;
attributedString.yy_lineBreakMode = NSLineBreakByWordWrapping;
return attributedString; return attributedString;
} }
@@ -132,6 +133,7 @@
_stackView.axis = UILayoutConstraintAxisVertical; _stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill; _stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentLeading; _stackView.alignment = UIStackViewAlignmentLeading;
_stackView.spacing = 0;
} }
return _stackView; return _stackView;
} }
@@ -158,7 +160,8 @@
_contentLabel.font = [UIFont systemFontOfSize:15]; _contentLabel.font = [UIFont systemFontOfSize:15];
_contentLabel.textColor = UIColorRGBAlpha(0x333333, 1); _contentLabel.textColor = UIColorRGBAlpha(0x333333, 1);
_contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH; _contentLabel.preferredMaxLayoutWidth = kMONENTS_CONTENT_MAX_WIDTH;
_contentLabel.lineBreakMode = NSLineBreakByCharWrapping; _contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
} }
return _contentLabel; return _contentLabel;
} }

View File

@@ -137,7 +137,7 @@
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view); make.left.right.top.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.view).offset(-UIInputBarViewMinHeight); make.bottom.mas_equalTo(self.inputBarView.mas_top);
}]; }];
[self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -268,7 +268,7 @@
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo { - (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClicFold:(MonentsInfoModel *)monentsInfo {
self.monentsInfo = monentsInfo; self.monentsInfo = monentsInfo;
[self.tableView reloadData]; [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
} }
#pragma mark - InputBoardDataSource #pragma mark - InputBoardDataSource