I have 3 functions:
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return fruits.count
}
and
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath ) {
if indexPath.row == 1 {
self.performSegueWithIdentifier("Herp", sender: self)
}
}
and
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("FoodList", forIndexPath: indexPath)
as UITableViewCell
let fruit = fruits[indexPath.row] as Fruit
cell.textLabel?.text = fruit.name
cell.detailTextLabel?.text = fruit.desc
return cell
}
Is there a way to combine them into a single function instead of have 3 separate tableView functions?
Aucun commentaire:
Enregistrer un commentaire