In iOS, we have CGContextRef, CGFontRef and such. What do ‘Ref’ indicate here? Are they refernces to objects of type CGContext, CGFont ? I do not understand this particular concept. Where can I look for the explanation of this concept?
Any help appreiated,
In iOS, we have CGContextRef, CGFontRef and such. What do ‘Ref’ indicate here? Are
Share
As far as I know, CGContextRef, CGFontRef and such are pointer types (typedefs) to plain C structures, not to Objective-C objects, and they are coming from older C frameworks of Mac OS X. See CGContext reference, CGFont reference, Core Foundation Design Concepts and Memory Management Programming Guide for Core Foundation. Because those *Ref objects are “toll-free bridged” with the Objective-C Cocoa framework, you can substitute them for Cocoa objects in function arguments, and vice versa (3). They have their own rules for memory management (4). I myself got a first brief but mostly sufficient explanation of those Core Foundation objects and frameworks by watching the Stanford iPhone Programming class videos (see also the class’ site).
Hope I gave you some pointers to start with.