-1
У меня есть 3 функции:Как я могу использовать несколько функций tableView в swift?
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return fruits.count
}
и
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row == 1 {
self.performSegueWithIdentifier("Herp", sender: self)
}
}
и
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
}
Есть ли способ, чтобы объединить их в одну функцию, а не иметь 3 отдельные функции Tableview?
Вы понимаете концепцию делегатов или событий? –