ios - Custom Row in Eureka -
i trying create custom row shows image. started trying basic custom row indicated in eureka's page: https://github.com/xmartlabs/eureka#basic-custom-rows
here's code using:
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 cell 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) // set cellprovider load .xib corresponding our cell cellprovider = cellprovider<customcell2>(nibname: "customcell2") } }
and saved customcell2.swift. calling custom row using this: futursection <<< customrow ("")
but getting error: could not load nib in bundle name 'customcell2'
and, how change uiimage?
hello had been reviewing question , results
i use code , make modifications eurekacustomimagecell.swift
import uikit import eureka public class customcell2: cell<bool>, celltype{ @iboutlet weak var customimage: uiimageview! public override func setup() { super.setup() } 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) // set cellprovider load .xib corresponding our cell cellprovider = cellprovider<customcell2>(nibname: "customcell2") } }
as can see here @iboutlet weak var customimage: uiimageview!
outlet defined in xib file custom cell, check image
i hope helps you, works me without problems
Comments
Post a Comment