公屏:更多消息按钮和消息追加逻辑调整

This commit is contained in:
zu
2021-11-19 19:32:33 +08:00
parent b7378c832b
commit 32a89f8773

View File

@@ -60,7 +60,8 @@
#pragma mark - Response
- (void)messageTipsBtnAction:(UIButton *)sender {
self.isPending = NO;
[self tryToAppendAndScrollToBottom];
self.messageTipsBtn.hidden = YES;
[self appendAndScrollToBottom];
}
#pragma mark - Private Method
@@ -96,27 +97,11 @@
///
- (void)addRoomMessage:(NIMMessage *)message {
[self.incomingMessages addObject:message];
///
[self tryToAppendAndScrollToBottom];
}
/**
*
* self.isPending self.incomingMessages
* self.messageTipsBtn self.messageTableView
*/
- (void)tryToAppendAndScrollToBottom {
//
if (self.isPending && self.incomingMessages.count > 0) {
if (self.isPending) {
self.messageTipsBtn.hidden = NO;
} else {
self.messageTipsBtn.hidden = YES;
[self appendAndScrollToBottom];
}
if (!self.isPending) {
//
[self appendAndScrollToBottom];
}
}
///
@@ -236,14 +221,20 @@
}
}
/** () */
/**
()
*/
- (void)finishDraggingWith:(UIScrollView *)scrollView {
CGFloat contentSizeH = scrollView.contentSize.height;
CGFloat contentOffsetY = scrollView.contentOffset.y;
CGFloat sizeH = scrollView.frame.size.height;
self.isPending = contentSizeH - contentOffsetY - sizeH > 20.0;
//
[self tryToAppendAndScrollToBottom];
if (!self.isPending) {
self.messageTipsBtn.hidden = YES;
if (self.incomingMessages.count > 0) {
[self appendAndScrollToBottom];
}
}
}