]>
Commit | Line | Data |
---|---|---|
1 | #import "ResetView.h" | |
2 | ||
3 | #include <objc/objc.h> | |
4 | #include <objc/runtime.h> | |
5 | ||
6 | #include <errno.h> | |
7 | ||
8 | #include <cstdio> | |
9 | #include <cstdlib> | |
10 | ||
11 | @implementation UIView (RVBook) | |
12 | ||
13 | - (void) resetViewAnimated:(BOOL)animated { | |
14 | fprintf(stderr, "%s\n", class_getName(self->isa)); | |
15 | _assert(false); | |
16 | } | |
17 | ||
18 | - (void) clearView { | |
19 | fprintf(stderr, "%s\n", class_getName(self->isa)); | |
20 | _assert(false); | |
21 | } | |
22 | ||
23 | @end | |
24 | ||
25 | @implementation UITable (RVBook) | |
26 | ||
27 | - (void) resetViewAnimated:(BOOL)animated { | |
28 | [self selectRow:-1 byExtendingSelection:NO withFade:animated]; | |
29 | } | |
30 | ||
31 | - (void) clearView { | |
32 | [self clearAllData]; | |
33 | } | |
34 | ||
35 | @end | |
36 | ||
37 | @implementation UITableView (RVBook) | |
38 | ||
39 | - (void) resetViewAnimated:(BOOL)animated { | |
40 | //[self selectRowAtIndexPath:nil animated:animated scrollPosition:UITableViewScrollPositionNone]; | |
41 | if (NSIndexPath *path = [self indexPathForSelectedRow]) | |
42 | [self deselectRowAtIndexPath:path animated:animated]; | |
43 | } | |
44 | ||
45 | - (void) clearView { | |
46 | //XXX:[[self table] clearView]; | |
47 | } | |
48 | ||
49 | @end | |
50 | ||
51 | @implementation UISectionList (RVBook) | |
52 | ||
53 | - (void) resetViewAnimated:(BOOL)animated { | |
54 | [[self table] resetViewAnimated:animated]; | |
55 | } | |
56 | ||
57 | - (void) clearView { | |
58 | [[self table] clearView]; | |
59 | } | |
60 | ||
61 | @end |