3 Replies
      Latest reply: Sep 12, 2016 1:10 AM by eskimo RSS
      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

            }

          

        }

        • Re: Get array in TableView
          eskimo Apple Staff Apple Staff (7,825 points)

          What version of Xcode are you using?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"