【发布时间】:2014-02-15 01:47:02
【问题描述】:
我在 Preference Bundle 中有一个 SliderCell,用于我正在开发的 iOS 7 调整。在任何 32 但设备上,当从滑块中拉出值时,调整工作正常。但是在 64 位设备上它不能正常工作并且它总是默认为 0.0
static float blur;
static float tint;
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.bla.blarfr~prefs.plist"];
static void NBLoad()
{
blur = [dict objectForKey:@"blurf"] ? [[dict objectForKey:@"blurf"] floatValue] : 0.0f;
tint = [dict objectForKey:@"tintf"] ? [[dict objectForKey:@"tintf"] floatValue] : 0.0f;
}
%hook UIKBFactory
-(float) tintAlpha {
NBLoad();
if ([[dict objectForKey:@"enabled"] boolValue])
{
return tint;
}
else
{
return %orig;
}
}
-(float) blurRadius {
NBLoad();
if ([[dict objectForKey:@"enabled"] boolValue])
{
return blur;
}
else
{
return %orig;
}
}
%end
如果我确实将所有浮点数更改为双精度,则它在 64 位上工作正常,反之亦然。有什么办法可以让代码在两个设备上都能正常工作?
【问题讨论】: