-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCCSectionView.x
50 lines (37 loc) · 900 Bytes
/
CCSectionView.x
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
//
// CCSectionView.x
// CCLoader
//
// Created by Jonas Gessner on 04.01.2014.
// Copyright (c) 2014 Jonas Gessner. All rights reserved.
//
#import "CCSectionView.h"
#import <objc/runtime.h>
#include <substrate.h>
%subclass CCSectionView : SBControlCenterSectionView
- (void)dealloc {
[self _CCLoader_setContentView:nil];
%orig;
}
%new
- (void)_CCLoader_setContentView:(UIView *)view {
[self._CCLoader_contentView removeFromSuperview];
if (view) {
[self addSubview:view];
}
objc_setAssociatedObject(self, @selector(contentView), view, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
%new
- (UIView *)_CCLoader_contentView {
return objc_getAssociatedObject(self, @selector(contentView));
}
- (void)layoutSubviews {
%orig;
self._CCLoader_contentView.frame = self.bounds;
}
%end
%ctor {
@autoreleasepool {
%init();
}
}