Custom Row in Eureka
Ich versuche, eine benutzerdefinierte Zeile zu erstellen, in der ein Bild angezeigt wird. Also habe ich zunächst die auf Eurekas Seite angegebene benutzerdefinierte Grundzeile ausprobiert:https: //github.com/xmartlabs/Eureka#basic-custom-row
Hier ist der Code, den ich verwende:
import Eureka
public class CustomCell2: Cell<Bool>, CellType{
@IBOutlet weak var switchControl: UISwitch!
@IBOutlet weak var label: UILabel!
public override func setup() {
super.setup()
switchControl.addTarget(self, action: #selector(CustomCell2.switchValueChanged), forControlEvents: .ValueChanged)
}
func switchValueChanged(){
row.value = switchControl.on
row.updateCell() // Re-draws the cell which calls 'update' bellow
}
public override func update() {
super.update()
backgroundColor = (row.value ?? false) ? .whiteColor() : .blackColor()
}
}
public final class CustomRow: Row<Bool, CustomCell2>, RowType {
required public init(tag: String?) {
super.init(tag: tag)
// We set the cellProvider to load the .xib corresponding to our cell
cellProvider = CellProvider<CustomCell2>(nibName: "CustomCell2")
}
}
Und das wird als CustomCell2.swift gespeichert. Ich rufe diese benutzerdefinierte Zeile folgendermaßen auf:futurSection <<< CustomRow ("")
Aber ich erhalte eine Fehlermeldung:Could not load NIB in bundle with name 'CustomCell2'
Und wie ändere ich das in ein UIImage?