请帮助调整此示例代码

时间:2012-10-04 23:16:25

标签: ios core-foundation cfmutabledictionary

我想调整下面的示例代码,以便在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];
            }
        }
    }

1 个答案:

答案 0 :(得分:0)

只需将所有CGPoint次出现的内容交换为unsigned int

相关问题