从Sierra the's pdf drawWithBox:toContext:
开始可用操作。但在以前的操作系统版本中,这不存在。当存在图形背景时,前任drawWithBox:
在存在上下文的情况下工作得很好(例如,在drawRect:
中)。但是如果你没有这样的背景,我就没有办法使用drawWithBox:
(除了采用“可能”存在的随机上下文)。我尝试这样做:在没有当前上下文的情况下绘制PDFPage
_contextRef =
CGBitmapContextCreate(_cvMat.data, ...
...
if (v12) {
[page drawWithBox:kPDFDisplayBoxBleedBox toContext:cgContext];
} else {
[NSGraphicsContext setCurrentContext:(__bridge NSGraphicsContext * _Nullable)(cgContext)];
[page drawWithBox:kPDFDisplayBoxBleedBox];
}
但只是把
- [__ NSCFType graphicsPort]:无法识别的选择发送到实例0x7f8de1e219a0
这是不是一个错误消息中遇到(或追捧) 常常。
[Mac OS X:使用CGContextRef C函数绘制到屏幕外NSGraphicsContext中可能有重复,但不起作用。为什么?](http://stackoverflow.com/questions/10627557/mac-os-x-drawing-into-an-offscreen-nsgraphicscontext-using-cgcontextref-c-funct) - 肯定这是一个重复的:-) –