RLT
RLT

Reputation: 4287

How do I uniquely identify cgcontext?

Is there any way by which it is possible to uniquely identify CGContextRef?

Thanks

Upvotes: 0

Views: 137

Answers (1)

Rob Keniger
Rob Keniger

Reputation: 46020

A CGContextRef is just a pointer to a CGContext struct. Because it's a pointer you can just use equality to check if they're the same context:

if( context1 == context2 )
{
    //the contexts are the same
}

If you need to keep track of particular contexts, just store a reference to them, in an ivar or other variable. You can then use equality to check if a context matches:

if( someContext == yourContextIvar )
{
    //the contexts are the same
}

Upvotes: 1

Related Questions