Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Xcode OSX Swift将图像添加到nstableview_Xcode_Swift_Macos_Nstableview - Fatal编程技术网

Xcode OSX Swift将图像添加到nstableview

Xcode OSX Swift将图像添加到nstableview,xcode,swift,macos,nstableview,Xcode,Swift,Macos,Nstableview,我添加了一个tableview,并用一个标识符很好地配置了单元格。 一切正常,显示单元格的文本。 我只有一个问题,不知道如何解决。 如何更改tableview单元格的图像 这是我的密码: func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? { let cellView = tableView.makeViewWithId

我添加了一个tableview,并用一个标识符很好地配置了单元格。 一切正常,显示单元格的文本。 我只有一个问题,不知道如何解决。 如何更改tableview单元格的图像

这是我的密码:

func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
    let cellView = tableView.makeViewWithIdentifier("cell", owner: self) as! NSTableCellView

    cellView.textField!.stringValue = self.objects.objectAtIndex(row) as! String

    return cellView
}
如何更改单元格内的图像


带有文本和图像的标准
NSTableCellView
有一个插座
imageView

cellView.imageView!.image = NSImage(named:"MyImage")