我正在寻找创建以下字典的方法
NSDictionary *frameProperties = [NSDictionary dictionaryWithObject:[NSDictionary
dictionaryWithObject:[NSNumber numberWithInt:2]
forKey:(NSString *) kCGImagePropertyGIFDelayTime]
forKey:(NSString *) kCGImagePropertyGIFDictionary];
通过CoreFoundation,即CFDictionaryCreate
任何想法如何实现这个?
答案 0 :(得分:3)
int delayOnEachFrame = 2;
const void *tkeys[1] = { kCGImagePropertyGIFDelayTime };
const void *tvalues[1] = { CFNumberCreate(0, kCFNumberSInt32Type, &delayOnEachFrame) };
CFDictionaryRef tframeProperties = CFDictionaryCreate(NULL, tkeys, tvalues, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
const void *keys[1] = { kCGImagePropertyGIFDictionary };
const void *values[1] = { tframeProperties };
CFDictionaryRef frameProperties = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);