Lord Vermillion
Lord Vermillion

Reputation: 5424

Table View Controller in storyboard with Class

I added a Table View Controller to my storyboard. Then i set the Class of the Table View Controller to my class SubscriptionsTableViewController: UITableViewController

Now i want to populate it with a cell i've made.

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = self.dequeueReusableCellWithIdentifier("subscriptionCell") as! SubscriptionsTableViewCell
return cell

This gives me Value of type SubscriptionsTableViewController has no member dequeueReusableCellWithIdentifier

How do i access the dequeueReusableCellWithIdentifier in TableViewController class? Shouldn't i be able to use self.dequeueReusableCellWithIdentifier since i've set the class in Storyboard?

Upvotes: 1

Views: 100

Answers (1)

Sergii Martynenko Jr
Sergii Martynenko Jr

Reputation: 1407

dequeueReusableCellWithIdentifier is not UITableViewController method. It is UITableView method

So, you need

let cell = tableView.dequeueReusableCellWithIdentifier("subscriptionCell") as! SubscriptionsTableViewCell

Check the documentation first.

Be sure to register SubscriptionsTableViewCell as cell class of your table view.

Upvotes: 2

Related Questions