我有一个存储缓存颜色的 plist 文件,它看起来像这样
<key>CachedColors</key>
<dict>
<key>com.Halfbrick.Fruit</key>
<string>0.00000,0.00000,0.00000</string>
<key>com.apple.Preferences</key>
<string>0.28824,0.37059,0.48235</string>
</dict>
我想要做的是使用 3 个值来创建 UIColor,UIColor 将根据捆绑 id 改变,值是红色、绿色和蓝色
但我希望 UIColor 在捆绑 ID 更改时自动更改,我将其用作横幅的背景颜色,并说如果我在主屏幕上并收到通知,则背景为白色,但是如果我打开“设置”应用程序,我希望它从 plist 中更改为 com.apple.Preferences 的 RGB 值,类似于在 iOS 6 中打开应用程序以匹配 UINavigationBar 时状态栏背景如何自动更改
我用了:
SBApplication *frontApp = [(SpringBoard*)[UIApplication sharedApplication] _accessibilityFrontMostApplication];
NSDictionary *statusBarCachedColors = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/cc.tweak.statuscolor.plist"];
NSString *colorString = [statusBarCachedColors objectForKey:frontApp];
NSArray *components = [colorString componentsSeparatedByString:@","];
UIColor *tintColor = [UIColor colorWithRed:[components[0] floatValue] green:[components[1] floatValue] blue:[components[2] floatValue] alpha:1.0];
我正在为越狱设备开发