0

我想修改下面的示例代码以在 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];
            }
        }
    }
4

1 回答 1

0

只需将所有CGPoint出现的情况交换为unsigned int.

于 2012-10-05T00:21:41.213 回答