FUINoteFormCell
public class FUINoteFormCell: FUIInlineValidationTableViewCell, FUIFormCell, UITextViewDelegate
The reusable UI component implemented as an UITableViewCell
to allow user enter notes.
Optionally, the developer may provide:
value
: The default text in the note.placeholderText
: The placeholder string to be put on the text area before user typed anything.isAutoFitting
: If this is true, the scroll will be disabled and the height of the cell will grow and shrink as needed. There is a minimum height that the cell will maintain.isEditable
: Indicates if the note text could be modified or not. The default is true.onChangeHandler
: a handler closure, which is invoked on changes to the value
The following is an example of usage in an application UITableViewController
:
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.register(FUINoteFormCell.self, forCellReuseIdentifier: FUINoteFormCell.reuseIdentifier)
// ...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUINoteFormCell.reuseIdentifier, for: indexPath) as! FUINoteFormCell
// If a value already exists, set it to the `value` property
cell.value = myObject.note
// Specify an optional placeholder text
cell.placeholderText = "Description"
// MARK: implement onChangeHandler
cell.onChangeHandler = { newValue in
myObject.note = newValue
}
return cell
}
-
The default cell reuse identifier.
Declaration
Swift
open static var reuseIdentifier: String
-
The note string.
Declaration
Swift
public var value: String
-
Implementation of change handler. Is invoked on changes to the
value
property.Declaration
Swift
public var onChangeHandler: ((String) -> Void)?
-
Indicates if the note text could be modified or not. The default is true.
Declaration
Swift
public var isEditable: Bool = true
-
The placeholder string to be put on the text area before user typed anything.
Declaration
Swift
public var placeholderText: String?
-
The UI component holds the note text.
Declaration
Swift
@IBOutlet public weak var valueTextView: SZTextViewNoteCellExt!
-
If
isTrackingLiveChanges == true
, thenonChangeHandler
, will be invoked for every letter entered.Otherwise,
onChangeHandler
will be invoked only after user tapsDone
key, or the field resigns first responder.Defaults to
false
.Declaration
Swift
public var isTrackingLiveChanges: Bool = false
-
If this is true, this
FUINoteFormCell
will grow in height and the cell will not be scrollable. Otherwise, the cell height will be fixed.Declaration
Swift
public var isAutoFitting: Bool = false
-
This is the maximum length of the note text, if maxNoteTextLength is greater than 0. If the text length reaches this limit, the user cannot enter more text. Note: If the user pastes a string and the length plus the current text length is greater than the limit, the insert is rejected. Partial strings are not accepted in the text field.
The default value for maxNoteTextLength is 0, which means no limit.
Declaration
Swift
public var maxNoteTextLength: Int = 0
-
The type of the keyboard being used when the cell is in input mode.
Declaration
Swift
public var keyboardType: UIKeyboardType = .default