处理滚动底部问题

This commit is contained in:
2026-01-29 14:42:49 +08:00
parent 25fbe9b64e
commit 32ebc6fb65
12 changed files with 174 additions and 26 deletions

View File

@@ -13,6 +13,7 @@
@property (nonatomic, strong) UIView *bubbleView;
@property (nonatomic, strong) UILabel *messageLabel;
@property (nonatomic, strong) UIActivityIndicatorView *loadingIndicator;
@end
@@ -44,12 +45,20 @@
self.messageLabel.textColor = [UIColor blackColor];
[self.bubbleView addSubview:self.messageLabel];
//
self.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.loadingIndicator.hidesWhenStopped = YES;
[self.contentView addSubview:self.loadingIndicator];
//
[self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(4);
make.bottom.equalTo(self.contentView).offset(-4);
make.right.equalTo(self.contentView).offset(-16);
make.width.lessThanOrEqualTo(self.contentView).multipliedBy(0.75);
// loading
make.height.greaterThanOrEqualTo(@40);
make.width.greaterThanOrEqualTo(@50);
}];
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -58,10 +67,24 @@
make.left.equalTo(self.bubbleView).offset(12);
make.right.equalTo(self.bubbleView).offset(-12);
}];
[self.loadingIndicator mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.contentView).offset(-16);
}];
}
- (void)configureWithMessage:(KBAiChatMessage *)message {
self.messageLabel.text = message.text;
if (message.isLoading) {
self.bubbleView.hidden = YES;
[self.loadingIndicator startAnimating];
} else {
self.bubbleView.hidden = NO;
self.messageLabel.hidden = NO;
[self.loadingIndicator stopAnimating];
}
}
@end