我的调整没有做任何事情,但我没有得到任何错误

时间:2015-04-11 15:34:37

标签: ios objective-c tweak

我正在创建一个调整来更改标签,状态栏,控件中心高亮颜色和其他文本的颜色。 我的代码在构建和编译时没有出错,但是当我更改颜色时它没有做任何事情。另外,奖励的事情,我想做一个'Respring!'按钮。 这是代码:

#import <UIKit/UIKit.h>

static BOOL enabled = YES;
static BOOL lsSame = YES;
static int labels = 0;
static int other = 13;
static int fg = 0;
static int bg = 13;
static int cc = 0;

/*
static UIColor *colorFromHexString(NSString *hexString) {
unsigned rgbValue = 0;
NSScanner *scanner = [NSScanner scannerWithString:hexString];
if ([hexString hasPrefix:@"#"]) {
[scanner setScanLocation:1];
} else {
[scanner setScanLocation:0];
}
[scanner scanHexInt:&rgbValue];
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
}

static UIColor *colorFromRGB(int colorR, int colorG, int colorB) {
return [UIColor colorWithRed: colorR/255.0 green: colorG/255.0 blue: colorB/255.0 alpha:1.0];
}
*/

%hook UILabel

-(void) setTextColor:(id)arg1 labels:(id)arg2 {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.jordanmckee.customcolr.plist"];
if (settings) {
enabled = ([settings objectForKey:@"enabled"] ? [[settings objectForKey:@"enabled"] boolValue] : enabled);
labels = ([settings objectForKey:@"labels"] ? [[settings objectForKey:@"labels"] intValue] : labels);

switch (labels) {
case 1:
labels =[UIColor blackColor];
break;
case 2:
labels = [UIColor darkGrayColor];
break;
case 3:
labels = [UIColor grayColor];
break;
case 4:
labels =[UIColor lightGrayColor];
break;
case 5:
labels = [UIColor whiteColor];
break;
case 6:
labels = [UIColor redColor];
break;
case 7:
labels = [UIColor greenColor];
break;
case 8:
labels = [UIColor blueColor];
break;
case 9:
labels = [UIColor cyanColor];
break;
case 10:
labels = [UIColor magentaColor];
break;
case 11:
labels = [UIColor purpleColor];
break;
case 12:
labels = [UIColor orangeColor];
break;
case 13:
labels = [UIColor yellowColor];
break;
case 14:
labels = [UIColor clearColor];
default:
break;
}

if (enabled) {
return %orig(arg1,arg2);
}
return %orig;
}
}

%end

%hook _UICascadingTextstorage

-(void) setTextColor:(id)arg1 other:(id)arg2 {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.jordanmckee.customcolr.plist"];
if (settings) {
enabled = ([settings objectForKey:@"enabled"] ? [[settings objectForKey:@"enabled"] boolValue] : enabled);
other = ([settings objectForKey:@"other"] ? [[settings objectForKey:@"other"] intValue] : other);

switch (other) {
case 1:
other = [UIColor blackColor];
break;
case 2:
other = [UIColor darkGrayColor];
break;
case 3:
other = [UIColor grayColor];
break;
case 4:
other = [UIColor lightGrayColor];
break;
case 5:
other = [UIColor whiteColor];
break;
case 6:
other = [UIColor redColor];
break;
case 7:
other = [UIColor greenColor];
break;
case 8:
other = [UIColor blueColor];
break;
case 9:
other = [UIColor cyanColor];
break;
case 10:
other = [UIColor magentaColor];
break;
case 11:
other = [UIColor purpleColor];
break;
case 12:
other = [UIColor orangeColor];
break;
case 13:
other = [UIColor yellowColor];
break;
case 14:
other = [UIColor clearColor];
default:
break;
}

if (enabled) {
return %orig(arg1,arg2);
}
return %orig;
}
}

%end

%hook UIStatusBarNewUIStyleAttributes

-(void)initWithRequest:(id)arg1 backgroundColor:(id)arg2 foregroundColor:(id)arg3 {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.jordanmckee.customcolr.plist"];
if (settings) {
enabled = ([settings objectForKey:@"enabled"] ? [[settings objectForKey:@"enabled"] boolValue] : enabled);
fg = ([settings objectForKey:@"fg"] ? [[settings objectForKey:@"fg"] intValue] : fg);
bg = ([settings objectForKey:@"bg"] ? [[settings objectForKey:@"bg"] intValue] : bg);

switch (fg) {
case 1:
fg = [UIColor blackColor];
break;
case 2:
fg = [UIColor darkGrayColor];
break;
case 3:
fg = [UIColor grayColor];
break;
case 4:
fg = [UIColor lightGrayColor];
break;
case 5:
fg = [UIColor whiteColor];
break;
case 6:
fg = [UIColor redColor];
break;
case 7:
fg = [UIColor greenColor];
break;
case 8:
fg = [UIColor blueColor];
break;
case 9:
fg = [UIColor cyanColor];
break;
case 10:
fg = [UIColor magentaColor];
break;
case 11:
fg = [UIColor purpleColor];
break;
case 12:
fg = [UIColor orangeColor];
break;
case 13:
fg = [UIColor yellowColor];
break;
case 14:
fg = [UIColor clearColor];
default:
break;
}

switch (bg) {
case 1:
bg = [UIColor blackColor];
break;
case 2:
bg = [UIColor darkGrayColor];
break;
case 3:
bg = [UIColor grayColor];
break;
case 4:
bg = [UIColor lightGrayColor];
break;
case 5:
bg = [UIColor whiteColor];
break;
case 6:
bg = [UIColor redColor];
break;
case 7:
bg = [UIColor greenColor];
break;
case 8:
bg = [UIColor blueColor];
break;
case 9:
bg = [UIColor cyanColor];
break;
case 10:
bg = [UIColor magentaColor];
break;
case 11:
bg = [UIColor purpleColor];
break;
case 12:
bg = [UIColor orangeColor];
break;
case 13:
bg = [UIColor yellowColor];
break;
case 14:
bg = [UIColor clearColor];
default:
break;
}

if (enabled) {
return %orig(arg1,arg2,arg3);
}
return %orig;
}
}

%end

%hook SBLockScreenViewController

-(int)statusBarStyle {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.jordanckee.customcolr.plist"];
if (settings) {
lsSame = ([settings objectForKey:@"lssame"] ? [[settings objectForKey:@"lssame"] boolValue] : lsSame);
}
if (lsSame) {
return 0;
}
return %orig;
}

%end

%hook SBControlCenterSettings

-(void)setHighlightedColor:(id)arg1 cc:(id)arg2 {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.jordanmckee.customcolr.plist"];
if (settings) {
enabled = ([settings objectForKey:@"enabled"] ? [[settings objectForKey:@"enabled"] boolValue] : enabled);
cc = ([settings objectForKey:@"cc"] ? [[settings objectForKey:@"cc"] boolValue] : cc);


switch (cc) {
case 1:
cc = [UIColor blackColor];
break;
case 2:
cc = [UIColor darkGrayColor];
break;
case 3:
cc = [UIColor grayColor];
break;
case 4:
cc = [UIColor lightGrayColor];
break;
case 5:
cc = [UIColor whiteColor];
break;
case 6:
cc = [UIColor redColor];
break;
case 7:
cc = [UIColor greenColor];
break;
case 8:
cc = [UIColor blueColor];
break;
case 9:
cc = [UIColor cyanColor];
break;
case 10:
cc = [UIColor magentaColor];
break;
case 11:
cc = [UIColor purpleColor];
break;
case 12:
cc = [UIColor orangeColor];
break;
case 13:
cc = [UIColor yellowColor];
break;
case 14:
cc = [UIColor clearColor];
default:
break;
}

if (enabled) {
return %orig(arg1,arg2);
}
return %orig;
}
}

%end

0 个答案:

没有答案
相关问题