Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa 向文档中添加图像_Cocoa_Core Data - Fatal编程技术网

Cocoa 向文档中添加图像

Cocoa 向文档中添加图像,cocoa,core-data,Cocoa,Core Data,我已经将NSPersistentDocument类划分为子类。我想在文档中添加一个图像。我有一个很好的形象。如何将其设置为.jpg文件?加载JPEG文件,并使用属性语法(self.image=[[NSImage alloc]initWithContentsOfFile:…]autorelease]在文档的属性中设置生成的NSImage)。同时,在nib中,将图像视图的值绑定到文档的图像属性

我已经将NSPersistentDocument类划分为子类。我想在文档中添加一个图像。我有一个很好的形象。如何将其设置为.jpg文件?

加载JPEG文件,并使用属性语法(
self.image=[[NSImage alloc]initWithContentsOfFile:…]autorelease]
在文档的属性中设置生成的
NSImage
)。同时,在nib中,将图像视图的
绑定到文档的
图像
属性