Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix.

  • Loading branch information...
commit eb44499c31a64034b2a01ac6c936466b6cbf4674 1 parent f8a307a
@meiwin authored
Showing with 23 additions and 7 deletions.
  1. +23 −7 main/MwfTableViewController.m
View
30 main/MwfTableViewController.m
@@ -1032,18 +1032,34 @@ - (MwfTableData *)createAndInitTableData;
- (void)setTableData:(MwfTableData *)tableData;
{
if (tableData) {
- _tableData = tableData;
+
__block MwfTableViewController * weakSelf = self;
- void(^go)(void) = ^{
- [weakSelf.tableView reloadData];
- };
- if ([NSThread isMainThread]) {
- go();
+ if (_isUpdating) {
+ double delayInSeconds = 0.1;
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
+ dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
+ [weakSelf setTableData:tableData];
+ });
} else {
- $inMain(go);
+ [self setTableDataInternal:tableData];
}
}
}
+- (void)setTableDataInternal:(MwfTableData *)tableData;
+{
+ _isUpdating = YES;
+ _tableData = tableData;
+ __block MwfTableViewController * weakSelf = self;
+ void(^go)(void) = ^{
+ [weakSelf.tableView reloadData];
+ _isUpdating = NO;
+ };
+ if ([NSThread isMainThread]) {
+ go();
+ } else {
+ $inMain(go);
+ }
+}
- (void)performUpdates:(void(^)(MwfTableData *))updates;
{
[self performUpdates:updates
Please sign in to comment.
Something went wrong with that request. Please try again.