XCode6/Swift: unrecognized selector sent to instance

后端 未结 3 1030
北恋
北恋 2021-02-15 10:58

Thought I\'d try my hand at iOS development since the Swift/ios8 announcement and I\'m having trouble getting a basic tableView to build.

Currently getting the following

3条回答
  •  面向向阳花
    2021-02-15 11:43

    As indicated in the first line of your dump, you're trying to send ...numberOfRows... to an object of class UIViewController but that method is only implemented in your subclass.

    In your nib file you need to change the class of your view controller from UIViewController (the default) to ViewController.

    Open your storyboard (or nib file) select the controller itself (it has an icon at the bottom (or top in Xcode 6) that will say "View Controller" when you mouse over it.

    enter image description here

    Then select the 3rd icon from the properties panel and up at the top where it says "Custom Class" enter "ViewController"

    enter image description here

提交回复
热议问题