У меня есть UITableView
. Я пытаюсь вывести ячейки первой и единственной секции задав их значения динамически. Вот мой контроллер:
import UIKit
class SettingsController: UITableViewController {
var sections = [10, 15, 30]
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return sections.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("minutesIntervalCell", forIndexPath: indexPath)
cell.textLabel?.text = String(sections[indexPath.row])
return cell
}
}
Вот, что у меня в Main.stroyboard:
При открытии этой вьюхи такая ошибка:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
Я так понимаю тут проблема в том, что в самой вьюхе только одна ячейка, а я пытаюсь задать три, но я же в коде говорю, что ячеек будет три, а он такое ощущение, что всё равно считает, что ячейка только одна.
Я уже волосы на себе рву, что делать. Пожалуйста помогите.