2
votes
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:   NSIndexPath) -> UITableViewCell {

    var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

    cell.textLabel!.text = self.funlists[indexPath.row]

    return cell
}

cannot invoke 'dequeReusable...' with an argument of type '(String)' on line var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

(sorry i'm extremely new to Xcode and swift) when i click my UITableView in my storyboard, it is a table view cell with style Subtitle and identifier cell. (I may be doing this completely wrong, not sure)

2
var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell",forIndexPath: indexPath) as UITableViewCell - Memon Irshad
define cell indentifier in storyboard - Memon Irshad
@Memon, thanks I have defined the cell identifier in the storyboard. When I change the line of code to what you provided, i get the error: cannot invoke 'dequeReusable...' with an argument of type '(String, forIndexPath: NSindexPath)' on line - moez05

2 Answers

2
votes

I think I find the problem, try to take the word self of the dequeueReusableCellWithIdentifier call, like this:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:   NSIndexPath) -> UITableViewCell {

    var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

    cell.textLabel!.text = self.funlists[indexPath.row]

    return cell
}

The reason been that you want to use the tableView coming from the function and not the tableView that belongs to the class.

Let me know if this solve your problem

1
votes

Please define your cell identifier in storyboard.

enter image description here