FUIValuePickerCollectionViewCell
open class FUIValuePickerCollectionViewCell : FUIBaseDrawingCollectionViewCell<FUIValuePickerContentView>
A UICollectionViewCell
subclass that allows a user to read or enter a value using a picker view.
And an onChangeHandler
:
onChangeHandler
: a handler closure that is invoked on changes to the value
Example of usage in an application, UICollectionViewController
:
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.register(FUIValuePickerCollectionViewCell.self, forCellWithReuseIdentifier: FUIValuePickerCollectionViewCell.reuseIdentifier)
// ...
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIValuePickerCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIValuePickerCollectionViewCell
cell.title.text = "Value Picker Title"
cell.valueOptions = ["1", "2", "3"]
cell.value = 0
cell.isTrackingLiveChanges = true
// MARK: implement onChangeHandler
cell.onChangeHandler = { [unowned cell] newValue in
cell.value = newValue
}
return cell
}
Theming
Supported TEXT
class paths:
fdlFUIValuePickerCollectionViewCell_title
fdlFUIValuePickerCollectionViewCell_valueText {}
Supported TEXT
properties:
font-color: Color;
font-style: UIFontTextStyle;
Supported TINTABLE
class paths:
fdlFUIValuePickerCollectionViewCell_valueText {}
Supported TINTABLE
properties:
font-color { -selected }: Color;
font-style { -selected }: UIFontTextStyle;
-
The array of valid options.
Declaration
Swift
public var valueOptions: [String] { get set }