Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix the illegal configuration?

Tags:

ios

swift

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
}
like image 899
blee Avatar asked Aug 31 '15 03:08

blee


People also ask

What are the solution to illegal operation?

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.

What Causes Illegal Operation error?

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.

What is Computer illegal operation?

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).


1 Answers

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.

like image 114
Fonix Avatar answered Oct 08 '22 03:10

Fonix