我想修改下面的示例代码以在 myValues 字典中存储uint值而不是CGPoint值。我不太熟悉如何使用 CoreFoundation 类型,所以在这里需要帮助:S
- (void)cacheBeginPointForTouches:(NSSet *)touches
{
CFMutableDictionaryRef myValues = CFDictionaryCreateMutable (
kCFAllocatorDefault,
20,
NULL,
NULL
);
if ([touches count] > 0) {
for (UITouch *touch in touches) {
CGPoint *point = (CGPoint *)CFDictionaryGetValue(myValues, touch);
if (point == NULL) {
point = (CGPoint *)malloc(sizeof(CGPoint));
CFDictionarySetValue(myValues, touch, point);
}
*point = [touch locationInView:view.superview];
}
}
}