Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift static table view disappears when connected to table view controller

I have created a simple static table view in my main storyboard but every time I hook up a blank UITableViewController the static view is not loading.

It should look like this (no controller file connected)When connected it looks like this

like image 273
André Kuhlmann Avatar asked Jan 08 '23 15:01

André Kuhlmann


1 Answers

Remove the default implementations of numberOfSectionsInTableView() and tableView(numberOfRowsInSection:) from your UITableViewController subclass.

i.e. remove those methods because they return 0:

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 0
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 0
}
like image 94
Matthias Bauch Avatar answered Jan 22 '23 01:01

Matthias Bauch