FUIFormTableViewController
open class FUIFormTableViewController : UITableViewController, FUIFormCellResponderDelegate, FUIFormCellNavigationDelegate
When FUIFormCell
s are to be used in an application, application’s implementation of
UITableViewController
that hosts these FUIFormCell
s must be a subclass of this
FUIFormTableViewController
. FUIFormTableViewController
hides all the complications
and interactions for handling all different types of FUIFormCell
s.
Application’s implementation of the UITableViewController
needs to only
implement the following functions:
class FormCellTestTVC: FUIFormTableViewController {
override func viewDidLoad() {
// MUST: Call viewDidLoad function of super class.
super.viewDidLoad()
// Register FUIFormCells that will be used
self.tableView.register(FUITitleFormCell.self, forCellReuseIdentifier: FUITitleFormCell.reuseIdentifier)
...
}
override func numberOfSections(in tableView: UITableView) -> Int {
// Return how many section in the table
return ...
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return number of rows in each section
...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Return the cell to be used at the IndexPath specified
let cell = tableView.dequeueReusableCell(withIdentifier: FUITitleFormCell.reuseIdentifier, for: indexPath) as! FUITitleFormCell
cell.value = "Work Request"
cell.isEditable = true
// MARK: implement onChangeHandler
cell.onChangeHandler = { newValue in
myObject.title = newValue
}
return cell
}
In addition, if there are some other actions on the table view, it is required that
the action functions should also call function endEditing
of the table view with the
force
parameter to true
so that all
editing cells have its onChangeHandler called. For example, the function didSaveTapped
below is the action when the Save
button tapped:
@IBAction func didSaveTapped(_ sender: AnyObject) {
self.tableView.endEditing(true)
// save object ...
}
-
The effective
UINavigationController
.Developer could set this to the
UINavigationController
for this view controller. If developer did not set this value, theUINavigationController
of this view controller will be returned if it is not nil. Otherwise, the rootUINavigationController
from thekeyWindow
, if any, will be returned.Declaration
Swift
public var effectiveNavigationController: UINavigationController? { get set }
-
Undocumented
Declaration
Swift
open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)