3 Replies
      Latest reply on Sep 12, 2016 1:10 AM by eskimo
      ak1982 Level 1 Level 1 (0 points)

        Hello together,

         

        I have a the problem, that my generated Table is empty. Has anybody an idea?

         

        Here is the Code:

         

         

        import Cocoa

        class FourthViewController: NSViewController {

         

            let Messen = [

                ("A"),

                ("B"),

                ("C")

            ]

         

            @IBOutlet weak var table: NSTableView!

          

            override func viewDidLoad() {

                super.viewDidLoad()

                table.setDelegate(self)

                table.setDataSource(self)

         

            }

          

          

            override var representedObject: AnyObject? {

                didSet {

         

                }

            }

        }

        extension FourthViewController: NSTableViewDataSource, NSTableViewDelegate {

            /

            func numberOfRowsInTableView(tableView: NSTableView) -> Int {

                return Messen.count

            }

          

            func tableView(tableView: NSTableView!, cellForRowAtIndexPath indexPath: NSIndexPath) -> NSTableCellView {

                var cell = NSTableCellView()

                let(test) = Messen [indexPath.item]

              

                cell.textField!.stringValue = test

                return cell

            }

          

        }