ll2p
ll2p

Reputation: 33

Nil inherited outlet

I've defined a base class which has an UITableView outlet.

class BaseController: UIViewController, UITableViewDataSource, UITableViewDelegate  {


@IBOutlet weak var tableView: UITableView!
...

Then I've inherited the class as follows:

class SubViewController: BaseController {

override func viewDidLoad() {
   tableView.rowHeight = screenHeigth / CGFloat(textArray.count)

But the tableView is nil, I've just recently started programming in swift, is it possible to inherit an outlet? If so, how should I do it?

I'm currently using Xcode 6.4

Upvotes: 3

Views: 646

Answers (1)

Sam Clewlow
Sam Clewlow

Reputation: 4351

You can inherit an outlet. In your storyboard (assumption), the view controller class name should be set to the name of your subclass. You can then connect up the table view to the outlet in the storyboard.

Upvotes: 2

Related Questions