我想调整下面的示例代码,以便在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];
}
}
}
答案 0 :(得分:0)
只需将所有CGPoint
次出现的内容交换为unsigned int
。