-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUITableView+ReloadDataAnimate.m
More file actions
38 lines (30 loc) · 1.25 KB
/
UITableView+ReloadDataAnimate.m
File metadata and controls
38 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// UITableView+ReloadDataAnimate.m
// n2nLeasing
//
// Created by Martin Darma Kusuma Tjandra on 2/19/16.
// Copyright © 2016 Martin Darma Kusuma Tjandra. All rights reserved.
//
#import "UITableView+ReloadDataAnimate.h"
@implementation UITableView (ReloadDataAnimate)
- (void) reloadDataWithAnimate:(BOOL)animate {
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfSections])];
if (animate)
[self reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic];
else
[self reloadSections:sections withRowAnimation:UITableViewRowAnimationNone];
}
- (void) reloadDataSection:(long)section animate:(BOOL)animate{
[self reloadDataSectionStart:section sectionCount:1 animate:animate];
}
- (void) reloadDataSection:(long)section{
[self reloadDataSection:section animate:YES];
}
- (void) reloadDataSectionStart:(long)section sectionCount:(long)count animate:(BOOL)animate {
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(section, count)];
if (animate)
[self reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic];
else
[self reloadSections:sections withRowAnimation:UITableViewRowAnimationNone];
}
@end