Trying to work out a couple of scenes in my application, I cannot get tableViews to work the way they should.
I make settings such as tableView , where the user chooses between two possible settings . Each parameter leads to a new tableView, where the user must select one of the available parameters . After the user selects one, the label in the first scene displays the selected value (which is also saved as NSUserDefaults). Therefore, if Im not mistaken, this can be achieved using 3 static table views. The following code: how am I trying to do this:
Controller for viewing the initial settings:
class SettingsVC2: UITableViewController{ override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 2 } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { if indexPath.section == 0{ let cell = tableView.dequeueReusableCellWithIdentifier("office_cell", forIndexPath: indexPath) cell.textLabel?.text = "Select your office" return cell } else { let cell = tableView.dequeueReusableCellWithIdentifier("dept_cell", forIndexPath: indexPath) cell.textLabel?.text = "Select your department" return cell }
One of the parameters for tableViews:
class SettingsDepartmentTVC: UITableViewController{ let departamentos: [String] = ["Sales", "Pre-Sales", "General Administration", "Customer Service", "Profesional Services", "Regionales"] override func viewDidLoad() { super.viewDidLoad()
I believe that all data sources and delegates are connected correctly, and UIKit is imported even if it is not displayed.
Erros Im receipt:
Confirmation error in - [UITableView dequeueReusableCellWithIdentifier: forIndexPath:]
Application termination due to the uncaught exception "NSInternalInconsistencyException", reason: "it is impossible to disconnect the cell with the identifier office_cell - must register a thread or class for the identifier or connect the cell prototype in the storyboard
This is the method in which I try to populate a tableView:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ let cell = tableView.dequeueReusableCellWithIdentifier("CommentsRowTVC", forIndexPath: indexPath) as! CommentsRowTVC let single_comment = self.AOS[indexPath.row] cell.titulo_comentario?.text = single_comment.titulo_comment cell.cuerpo_comentario?.text = single_comment.cuerpo_comment cell.fecha_comentario?.text = single_comment.fecha_comment return cell } class CommentsRowTVC: UITableViewCell { @IBOutlet weak var titulo_comentario: UILabel! @IBOutlet weak var cuerpo_comentario: UILabel! @IBOutlet weak var fecha_comentario: UILabel! override func awakeFromNib() { super.awakeFromNib()
}
Here is the connection inspector for the UIViewController where the table is located:

And this one for UIViewCellController:

Errors to this point:
UIView tableView: numberOfRowsInSection: unrecognized selector sent to instance
The application terminated due to an unmapped NSInvalidArgumentException exception, reason: [UIView tableView: numberOfRowsInSection:]: unrecognized selector sent to the instance