summaryrefslogtreecommitdiff
path: root/UICaboodle/ResetView.mm
blob: bd1c8ee8b82d253abe55c47979dd7dfa14a1c43d (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#import "ResetView.h"

#include <objc/objc.h>
#include <objc/runtime.h>

#include <errno.h>

#include <cstdio>
#include <cstdlib>

@implementation UIView (RVBook)

- (void) resetViewAnimated:(BOOL)animated {
    fprintf(stderr, "%s\n", class_getName(self->isa));
    _assert(false);
}

- (void) clearView {
    fprintf(stderr, "%s\n", class_getName(self->isa));
    _assert(false);
}

@end

@implementation UITable (RVBook)

- (void) resetViewAnimated:(BOOL)animated {
    [self selectRow:-1 byExtendingSelection:NO withFade:animated];
}

- (void) clearView {
    [self clearAllData];
}

@end

@implementation UITableView (RVBook)

- (void) resetViewAnimated:(BOOL)animated {
    //[self selectRowAtIndexPath:nil animated:animated scrollPosition:UITableViewScrollPositionNone];
    if (NSIndexPath *path = [self indexPathForSelectedRow])
        [self deselectRowAtIndexPath:path animated:animated];
}

- (void) clearView {
    //XXX:[[self table] clearView];
}

@end

@implementation UISectionList (RVBook)

- (void) resetViewAnimated:(BOOL)animated {
    [[self table] resetViewAnimated:animated];
}

- (void) clearView {
    [[self table] clearView];
}

@end