Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3ba3b2e

Browse files
author
张国晔
committed
Add Switch
tap the section above to enable/disable
1 parent 46e666e commit 3ba3b2e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Tweak.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
NSArray *map;
66
NSInteger count;
7+
BOOL enabled = YES;
78

89
- (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
910
NSInteger result = %orig(view, section);
@@ -43,10 +44,18 @@ - (NSInteger)tableView:(id)view numberOfRowsInSection:(NSInteger)section {
4344
}
4445

4546
- (id)tableView:(id)view cellForRowAtIndexPath:(NSIndexPath *)indexPath {
46-
if (indexPath.row < count && [[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 2)
47+
if (enabled && indexPath.row < count && [[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 2)
4748
return %orig(view, [NSIndexPath indexPathForRow:((Entry *)map[indexPath.row]).index inSection:indexPath.section]);
4849
else
4950
return %orig(view, indexPath);
5051
}
5152

53+
- (void)tableView:(id)view didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
54+
if ([[self specifier].identifier isEqualToString:@"MOBILE_DATA_SETTINGS_ID"] && indexPath.section == [self numberOfSectionsInTableView:view] - 3) {
55+
enabled = !enabled;
56+
[view reloadData];
57+
}
58+
%orig;
59+
}
60+
5261
%end

control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: com.ccdog.cellularusageorder
22
Name: CellularUsageOrder
33
Depends: firmware (>= 7.0), mobilesubstrate
4-
Version: 1.0
4+
Version: 1.1
55
Architecture: iphoneos-arm
66
Description: Order Cellular Data Usage by Size.
77
Author: CC-Dog <[email protected]>

0 commit comments

Comments
 (0)