-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
68 lines (57 loc) · 2.12 KB
/
Tweak.xm
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
62
63
64
65
66
67
68
@interface CCUIControlCenterViewController : UIViewController
- (void)_addContentViewController:(UIViewController*)arg1;
- (void)_loadPages;
- (id)_selectedViewController;
- (id)_selectedContentViewController;
- (void)setRevealPercentage:(int)arg1;
@property (nonatomic, assign) CGFloat correctMaxHeight;
@end
@interface CCUIControlCenterPageContainerViewController : UIViewController
- (id)contentViewController;
@end;
CGFloat ccHeight = 200;
// Create CC page
%subclass TestPageViewController : CCUIControlCenterPageContainerViewController
- (void)viewDidLoad {
//UIView *view = [self view];
}
%end
%hook CCUIControlCenterViewController
%property (nonatomic, assign) CGFloat correctMaxHeight;
// Load CC page
- (void)_loadPages {
%orig;
UIViewController *pageView = [[%c(TestPageViewController) alloc] init];
[self _addContentViewController:pageView];
[pageView release];
}
// Change height of CC page
// (delete the two functions if you don't want to change cc page height)
-(CGFloat)_scrollviewContentMaxHeight {
self.correctMaxHeight = %orig;
id content = [self _selectedContentViewController];
BOOL rightPage = [[content class] isEqual:NSClassFromString(@"TestPageViewController")];
if (rightPage) {
return ccHeight;
}
return %orig;
}
- (CGRect)_frameForChildViewController:(CCUIControlCenterPageContainerViewController *)viewController {
CGRect origFrame = %orig;
if([[[viewController contentViewController] class] isEqual:NSClassFromString(@"TestPageViewController")]) {
if (viewController != [self _selectedViewController]) {
return CGRectMake(origFrame.origin.x, self.correctMaxHeight - ccHeight, origFrame.size.width, ccHeight);
} else {
return CGRectMake(origFrame.origin.x, 0, origFrame.size.width, ccHeight);
}
} else {
if ([self _selectedContentViewController]) {
if([[[self _selectedContentViewController] class] isEqual:NSClassFromString(@"TestPageViewController")]) {
CGFloat pushDown = (ccHeight - self.correctMaxHeight);
return CGRectMake(origFrame.origin.x, pushDown, origFrame.size.width, self.correctMaxHeight);
}
}
}
return %orig;
}
%end