1
我正在嘗試創建一個顯示圖像的自定義行。於是我開始試圖在尤里卡的網頁表示的基本自定義行:https://github.com/xmartlabs/Eureka#basic-custom-rows尤里卡的自定義行
下面是我使用的代碼:
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")
}
}
,這是保存爲CustomCell2.swift。我打電話使用這一點,自定義行:futurSection <<< CustomRow ("")
但我得到一個錯誤:Could not load NIB in bundle with name 'CustomCell2'
而且,我怎麼改變成一個UIImage的?
你有CustomCell2筆尖定義? –
我想我沒有那個。我不知道該怎麼做。 –
好的,我會檢查併發布任何結果,問候 –