The example code “Handling a Complex Multi-Touch Sequence” in the Event Handling section of the iPhone Application Programming Guide provides an incomplete example that assumes the reader knows enough fill-in the blanks. I know enough to know that I don’t know enough to do that without some clarification.
In Listing 3-6, I assume touchBeginPoints is a member property of type CFDictionaryRef. Correct?
In that same example, we’re using malloc() so I assume we need to call free() at some later point. My question is what am I freeing and when? Should I free() the individual points in touchesEnded:/touchesCancelled:? How would I do that? (I assume I need to read up on enumerating CFDictionaryRef) Or would I free(touchBeginPoints); in my dealloc: method?
Finally, in Listing 3-7 there is a compareAddress: method. How (and where) would I implement that?
Update Found the answer to the last one.
freeing the keys, you probably want to pass in a custom release callback when you create the dictionary. The key release callback is called for each element in the dictionary when the dictionary itself is released. (See the last two parameters toCFMutableDictionaryCreatefor more.)compareAddress:would look something like: