【发布时间】:2014-10-20 21:00:07
【问题描述】:
关于 kCGImageSourceShouldCache 的默认值,文档和头文件之间存在冲突。他们说的恰恰相反。显然,解决方法是显式设置值,但了解处理遗留代码的真正默认行为会很有用。
文档说:
kCGImageSourceShouldCache
图像是否应该以解码的形式缓存。此键的值必须是 CFBolean 值。默认值为 32 位的 kCFBooleanTrue,64 位的 kCFBooleanFalse。该键可以在选项字典中提供,您可以将其传递给函数 CGImageSourceCopyPropertiesAtIndex 和 CGImageSourceCreateImageAtIndex。
适用于 iOS 4.0 及更高版本。
在 CGImageSource.h 中声明。
头文件说:
/* Specifies whether the image should be cached in a decoded form. The
* value of this key must be a CFBooleanRef.
* kCFBooleanFalse indicates no caching, kCFBooleanTrue indicates caching.
* For 64-bit architectures, the default is kCFBooleanTrue, for 32-bit the default is kCFBooleanFalse.
*/
IMAGEIO_EXTERN const CFStringRef kCGImageSourceShouldCache
IMAGEIO_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_4_0);
【问题讨论】:
-
现在 the doc says "默认值是 32 位的 kCFBooleanFalse,64 位的 kCFBooleanTrue"。
标签: ios macos core-graphics 32bit-64bit