FUIKeyValueFormCell
open class FUIKeyValueFormCell : FUINoteFormCell
extension FUIKeyValueFormCell: FUIPropertyFormCell
A customized UITableViewCell
, which contains a UILabel
and a UITextView
. It takes text as input.
This is a new implementation to replace the previous implementation of FUIKeyValueFormCell
. It has a keyName
field and an editable value text field to
let user entered the value for this property.
This cell height is automatically adjusted to allow the whole content to be displayed.
However, the cell height is also limited to the height of the screen above the soft keyboard height.
Developer could use to UITableViewDelegate
‘s func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
to set a fixed height for the cell.
The character counter can be enabled by setting isCharCountEnabled
. It will show the updated character count number during editing, or the number of characters that have been loaded from the back end. An error message will be shown if the maxNoteTextLength
is reached. It will also show the text input field in error state and a semantic negative color. The user can continue to input text if allowsBeyondLimit
is true
.
If allowsBeyondLimit
is false
, it will auto-stop user input when maxNoteTextLength
is reached.
The application can validate the user input value and show an error message by setting hasError
and errorText
. The text input field will be displayed in an error state with an error message and a semantic negative color. The error message can be shown in the validationMessage
if showsErrorInValidationMsg
is true
. Otherwise, the error message will be shown in the errorView
in the same layout as the hintView
.
Usage
let cell = tableView.dequeueReusableCell(withIdentifier: FUIKeyValueFormCell.reuseIdentifier) as! FUIKeyValueFormCell
cell.onChangeHandler = { [unowned self] newValue in
print("value: \(newValue)")
self.value = newValue
}
cell.keyName = "Project Title"
cell.placeholder.text = "Please enter a title"
cell.value = value
cell.isTrackingLiveChanges = true
return cell
Theming
Supported TEXT
class paths:
fdlFUIKeyValueFormCell_title {}
fdlFUIKeyValueFormCell_valueText {}
fdlFUIKeyValueFormCell_placeholder {}
fdlFUIKeyValueFormCell_subtitle {}
Supported TEXT
properties:
font-color: Color;
font-style: UIFontTextStyle;
Supported TINTABLE
class paths:
fdlFUIKeyValueFormCell_title {}
fdlFUIKeyValueFormCell_valueText {}
Supported TINTABLE
properties:
tint-color { -disabled }: Color;
font-style { -disabled }: UIFontTextStyle;