我正在尝试自定义MultipleSelectorRow提供的控制器背景,但我不能。
IndexedChanged += new IndexChangedEventHandler(IndexChanged_EventHandler);
private void IndexChanged_EventHandler(int newValue)
{
//call your update method here
}
这不起作用,因为触发回调时to.tableView为nil。
我认为如果不对Eureka库进行修改就无法修改控制器
由于
答案 0 :(得分:1)
我找到了一个解决方案,我按以下方式将原始的MultipleSelectorViewController子类化:
import Foundation
import Eureka
import ChameleonFramework
public class MFAMultipleSelectorViewController<T:Hashable> : MultipleSelectorViewController<T> {
open override func viewDidLoad() {
super.viewDidLoad()
setTableViewBackgroundGradient(FlatMintDark(), FlatMintDark().lighten(byPercentage: 0.05)!)
}
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.backgroundColor = ClearColor()
}
}
open class _MFAMultipleSelectorRow<T: Hashable, Cell: CellType>: GenericMultipleSelectorRow<T, Cell, MFAMultipleSelectorViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == Set<T> {
public required init(tag: String?) {
super.init(tag: tag)
}
}
public final class MFAMultipleSelectorRow<T: Hashable> : _MFAMultipleSelectorRow<T, PushSelectorCell<Set<T>>>, RowType {
public required init(tag: String?) {
super.init(tag: tag)
}
}
答案 1 :(得分:0)
LabelRow.defaultCellUpdate = { cell, row in
cell.contentView.backgroundColor = .red
cell.textLabel?.textColor = .white
cell.textLabel?.font = UIFont.boldSystemFont(ofSize: 13)
cell.textLabel?.textAlignment = .right