Skip to content

Commit 8029bfd

Browse files
committed
修复topLayoutGuide的bug
1 parent fd1b034 commit 8029bfd

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

Example/MessageDisplayKitCoreDataExample/MessageDisplayKitCoreDataExample/XHDemoWeChatMessageTableViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ - (void)loadMoreMessagesScrollTotop {
407407
WEAKSELF
408408
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
409409
NSMutableArray *messages = [weakSelf getTestMessages];
410-
sleep(3);
411410
dispatch_async(dispatch_get_main_queue(), ^{
412411
[weakSelf insertOldMessages:messages];
413412
weakSelf.loadingMoreMessage = NO;

Example/MessageDisplayKitStoryBoradExample/MessageDisplayKitStoryBoradExample/XHDemoWeChatMessageTableViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ - (void)loadMoreMessagesScrollTotop {
250250
WEAKSELF
251251
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
252252
NSMutableArray *messages = [weakSelf getTestMessages];
253-
sleep(3);
254253
dispatch_async(dispatch_get_main_queue(), ^{
255254
[weakSelf insertOldMessages:messages];
256255
weakSelf.loadingMoreMessage = NO;

Example/MessageDisplayKitWeChatExample/MessageDisplayKitWeChatExample/Controllers/XHDemoWeChatMessageTableViewController/XHDemoWeChatMessageTableViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ - (void)loadMoreMessagesScrollTotop {
307307
WEAKSELF
308308
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
309309
NSMutableArray *messages = [weakSelf getTestMessages];
310-
sleep(2);
311310
dispatch_async(dispatch_get_main_queue(), ^{
312311
[weakSelf insertOldMessages:messages];
313312
weakSelf.loadingMoreMessage = NO;

Example/MessageDisplayKitWeChatExample/MessageDisplayKitWeChatExample/Controllers/XHProfileTableViewController/XHMoreExpressionShopsTableViewController/XHMoreExpressionShopsTableViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ @implementation XHMoreExpressionShopsTableViewController
2323
- (void)loadDataSource {
2424
self.isDataLoading = YES;
2525
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
26-
sleep(1);
2726
NSMutableArray *dataSource = [NSMutableArray arrayWithArray:@[@"emotionShopOne", @"emotionShopOne", @"emotionShopOne", @"emotionShopOne", @"emotionShopTwo", @"emotionShopOther", @"emotionShopTwo", @"", @"emotionShopTwo", @"emotionShopOther", @"emotionShopOne", @"emotionShopOther", @"emotionShopTwo", @"emotionShopOne", @"emotionShopTwo"]];
2827

2928
dispatch_async(dispatch_get_main_queue(), ^{

MessageDisplayKit/Classes/Controllers/XHMessageTableViewController/XHMessageTableViewController.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ - (void)initilzer {
510510
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
511511
self.automaticallyAdjustsScrollViewInsets = NO;
512512
}
513+
514+
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
515+
self.edgesForExtendedLayout = UIRectEdgeNone;
516+
}
517+
513518
// 默认设置用户滚动为NO
514519
_isUserScrolling = NO;
515520

@@ -711,7 +716,6 @@ - (NSString *)getRecorderPath {
711716
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
712717
dateFormatter.dateFormat = @"yy-MMMM-dd";
713718
recorderPath = [[NSString alloc] initWithFormat:@"%@/Documents/", NSHomeDirectory()];
714-
// dateFormatter.dateFormat = @"hh-mm-ss";
715719
dateFormatter.dateFormat = @"yyyy-MM-dd-hh-mm-ss";
716720
recorderPath = [recorderPath stringByAppendingFormat:@"%@-MySound.caf", [dateFormatter stringFromDate:now]];
717721
return recorderPath;
@@ -804,7 +808,7 @@ - (UIEdgeInsets)tableViewInsetsWithBottomValue:(CGFloat)bottom {
804808
UIEdgeInsets insets = UIEdgeInsetsZero;
805809

806810
if ([self respondsToSelector:@selector(topLayoutGuide)]) {
807-
insets.top = 64;
811+
insets.top = self.topLayoutGuide.length;
808812
}
809813

810814
insets.bottom = bottom;
@@ -1143,7 +1147,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
11431147
if ([self.delegate respondsToSelector:@selector(shouldLoadMoreMessagesScrollToTop)]) {
11441148
BOOL shouldLoadMoreMessages = [self.delegate shouldLoadMoreMessagesScrollToTop];
11451149
if (shouldLoadMoreMessages) {
1146-
if (scrollView.contentOffset.y >=0 && scrollView.contentOffset.y <= 44) {
1150+
if (scrollView.contentOffset.y >= 0 && scrollView.contentOffset.y <= 44) {
11471151
if (!self.loadingMoreMessage) {
11481152
if ([self.delegate respondsToSelector:@selector(loadMoreMessagesScrollTotop)]) {
11491153
[self.delegate loadMoreMessagesScrollTotop];

0 commit comments

Comments
 (0)