Closed liorp closed 6 years ago
Please make sure you set the heights only for the leftRow
and the rightRow
. SplitRow
calculates it's own height automatically based upon the provides rows.
For leftRow
and rightRow
the height works, if you set it in the row initialisation part - it seems like doing so in cellUpdate
is too late for SplitRow
doing things right.
Here's a working example based upon your code:
<<< SplitRow<ImageRow,ImageRow>() {
$0.rowLeft = ImageRow(){
$0.baseCell.height = { return 200 }
$0.title = "Cheque"
$0.sourceTypes = [.Camera, .PhotoLibrary]
$0.clearAction = .yes(style: UIAlertActionStyle.destructive)
$0.add(rule: RuleRequired())
}.cellUpdate { cell, row in
if !row.isValid {
cell.textLabel?.textColor = .red
} else {
cell.textLabel?.textColor = .black
}
cell.accessoryView?.layer.cornerRadius = 5
cell.accessoryView?.frame = CGRect(x: 0, y: 0, width: 180, height: 180)
}
$0.rowRight = ImageRow(){
$0.baseCell.height = { return 200 }
$0.title = "ID"
$0.sourceTypes = [.Camera, .PhotoLibrary]
$0.clearAction = .yes(style: UIAlertActionStyle.destructive)
$0.add(rule: RuleRequired())
}.cellUpdate { cell, row in
if !row.isValid {
cell.textLabel?.textColor = .red
} else {
cell.textLabel?.textColor = .black
}
cell.accessoryView?.layer.cornerRadius = 5
cell.accessoryView?.frame = CGRect(x: 0, y: 0, width: 180, height: 180)
}
Whid produces the following output on my end:
You might have to further tweak the ImageRow
appearance if you want to hide the textLabels for example. Also, SplitRow
divides the space by default in two columns with a width of 30%/70%. If you want to change this too, you should have a look at the rowLeftPercentage
property of SplitRow
.
Hi,
I tried the following: ` <<< SplitRow<ImageRow,ImageRow>() { $0.baseCell.height = { return 200 }
` But the height is weird and uncontrollable, something overrides the height of the ImageRow. BTW: It doesn't work even if the height is unchanged.