I have a UITableView . I try to display the cells of the first and only section by setting their values dynamically. Here is my controller:
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 } } Here is what I have in Main.stroyboard:
When opening this view, this error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** - [__ NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
I understand the problem here is that there is only one cell in the view itself, and I try to set three, but I’m in the code saying that there will be three cells, and he has the feeling that he still believes that there is only one cell.
I already ditch my hair what to do. Please, help.
