-
Notifications
You must be signed in to change notification settings - Fork 1
/
UITableView_TLCommon.m
32 lines (26 loc) · 1.21 KB
/
UITableView_TLCommon.m
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
//
// UITableView_TLCommon.m
// TLCommon
//
// Created by Joshua Bleecher Snyder on 9/15/09.
//
#import "UITableView_TLCommon.h"
@implementation UITableView (TLCommon)
- (void)reloadRowAtRow:(NSUInteger)row section:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation {
[self reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:section]]
withRowAnimation:animation];
}
- (void)reloadRowAtIndexPath:(NSIndexPath *)indexPath withRowAnimation:(UITableViewRowAnimation)animation {
[self reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:animation];
}
- (void)deleteRowsInRowRange:(NSRange)rowRange section:(NSUInteger)section withRowAnimation:(UITableViewRowAnimation)animation {
// there's got to be a better way...
NSMutableArray *indexPathsToDelete = [NSMutableArray arrayWithCapacity:rowRange.length];
for(NSUInteger i = 0; i < rowRange.length; i++) {
NSIndexPath *indexPathToDelete = [NSIndexPath indexPathForRow:rowRange.location + i inSection:section];
[indexPathsToDelete addObject:indexPathToDelete];
}
[self deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:animation];
}
@end