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?
答案 0 :(得分:2)
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.