I have a .xib file and I want that to be a table view controller, but when I create a table view controller in the .xib file I get the error:
Table views with embedded sections and cells are only supported in storyboard documents
.
How do I fix this?
Below is my code for the actual table view:
self.add = [Play(name: title!), Play(name: artist!), Play(name: album!)]
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.add.count
//return count of objects in array
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
var play: Play
play = add[indexPath.row]
cell.textLabel?.text = play.name
return cell
}
Corrupt files Illegal Operations may be generated by corrupt, flawed, or missing files. You can try uninstalling the program that caused the Illegal Operation and then reinstalling it to check if any corrupt, bad, or missing files are replaced or rectified during the reinstallation.
The most common causes of an illegal operation include a problem between that program and a software driver in your operating system or a memory-management problems between the program and one open in the background.
An operation that is not authorized or understood. An "illegal operation" error message typically means that the computer has been directed to execute an invalid instruction and has stopped or has terminated the offending application (see abend).
Xibs are sort of out dated, and when they were invented, didn't have prototype cells that you could make in the Interface Builder.
When storyboards were introduced this functionality was made as well, except not back ported to the xib editor, so you can't use prototype cells in a xib unfortunately, you will need to make separate xibs for the cells layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With