0

I have a CGImageRef variable and a CGRect (so no pointers) and I need to add it to an NSDictionary. Like an NSArray, NSDictionary-s only accept pointers. How can you add an CGImageRef or an CGRect anyway?

1 Answers1

2

CGImageRef is already a pointer, but it's not (AFAIK) a pointer to a valid Cocoa object. You can turn a CGImage into a Cocoa NSBitmapImageRep with [[NSBitmapImageRep alloc] initWithCGImage:someimageref]. And NSValue is there to wrap primitive types like CGRect.

Chuck
  • 234,037
  • 30
  • 302
  • 389