有什么方法可以唯一标识CGContextRef吗?
谢谢
最佳答案
CGContextRef
只是指向 CGContext
结构的指针。因为它是一个指针,所以您可以使用相等来检查它们是否是相同的上下文:
if( context1 == context2 )
{
//the contexts are the same
}
如果您需要跟踪特定上下文,只需将对它们的引用存储在 ivar 或其他变量中即可。然后,您可以使用相等性来检查上下文是否匹配:
if( someContext == yourContextIvar )
{
//the contexts are the same
}
关于cocoa - 如何唯一标识cgcontext?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6830644/