Skip to content

Commit

Permalink
Merge pull request #26 from JoshAtPCI/master
Browse files Browse the repository at this point in the history
Change backgroundColor of leftRow and rightRow
  • Loading branch information
marbetschar authored Jan 2, 2019
2 parents 048e940 + a60a3c0 commit e21dd4f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions SplitRow/SplitRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ open class _SplitRow<L: RowType, R: RowType>: Row<SplitRowCell<L,R>> where L: Ba
subscribe(onCellHighlightChanged: row)
}
}

/// The left rows background color.
/// - note: Use `cell.backgroundColor` to change the entire row's background color.
public var rowLeftBackgroundColor: UIColor? {
get { return cell.tableViewLeft.backgroundColor }
set { cell.tableViewLeft.backgroundColor = newValue }
}

public var rowLeftPercentage: CGFloat = 0.3

public var rowRight: R?{
Expand All @@ -91,6 +99,13 @@ open class _SplitRow<L: RowType, R: RowType>: Row<SplitRowCell<L,R>> where L: Ba
subscribe(onCellHighlightChanged: row)
}
}

/// The right rows background color.
/// - note: Use `cell.backgroundColor` to change the entire row's background color.
public var rowRightBackgroundColor: UIColor? {
get { return cell.tableViewRight.backgroundColor }
set { cell.tableViewRight.backgroundColor = newValue }
}

public var rowRightPercentage: CGFloat{
return 1.0 - self.rowLeftPercentage
Expand Down
4 changes: 3 additions & 1 deletion SplitRow/SplitRowCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Eureka

open class SplitRowCell<L: RowType, R: RowType>: Cell<SplitRowValue<L.Cell.Value,R.Cell.Value>>, CellType where L: BaseRow, R: BaseRow{
var tableViewLeft: SplitRowCellTableView<L>!
var tableViewRight: SplitRowCellTableView<R>!
var tableViewRight: SplitRowCellTableView<R>!

open override var isHighlighted: Bool {
get { return super.isHighlighted || (tableViewLeft.row?.cell?.isHighlighted ?? false) || (tableViewRight.row?.cell?.isHighlighted ?? false) }
Expand All @@ -21,11 +21,13 @@ open class SplitRowCell<L: RowType, R: RowType>: Cell<SplitRowValue<L.Cell.Value
super.init(style: style, reuseIdentifier: reuseIdentifier)

self.tableViewLeft = SplitRowCellTableView()
tableViewLeft.backgroundColor = .clear
tableViewLeft.separatorStyle = .none
tableViewLeft.leftSeparatorStyle = .none
tableViewLeft.translatesAutoresizingMaskIntoConstraints = false

self.tableViewRight = SplitRowCellTableView()
tableViewRight.backgroundColor = .clear
tableViewRight.separatorStyle = .none
tableViewRight.leftSeparatorStyle = .singleLine
tableViewRight.translatesAutoresizingMaskIntoConstraints = false
Expand Down

0 comments on commit e21dd4f

Please sign in to comment.