FUISearchController
open class FUISearchController : UISearchController, FUIBarcodeScanViewControllerDelegate
Fiori style UISearchController. The only difference between FUISearchController
and regular UISearchController
is the searchBar
.
FUISearchController
‘s searchBar
is FUISearchBar
.
Developer can add a FUIBarcodeScanner
to this FUISearchBar
by setting the
isBarcodeScannerEnabled
property of the FUISearchBar
to true. A barcode scanner
icon will be displayed at the bookmark icon location of the search bar.
A barcode scanner view will be displayed when the barcode scanner icon is tapped.
For iOS 11, it is recommended to set the FUISearchController
to navigationItem
,
instead of the table view header for iOS 10.
Here is a sample code snippet.
// Instantiate an FUISearchController and configure its properties
searchController = FUISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.hidesNavigationBarDuringPresentation = true
searchController.searchBar.placeholderText = "Search The List"
// Adding barcode scanner to this search bar
searchController.searchBar.isBarcodeScannerEnabled = true
searchController.searchBar.barcodeScanner?.scanMode = .EAN_UPC
searchController.searchBar.barcodeScanner?.scanResultTransformer = { (scanString) -> String in
return scanString.uppercased()
}
if #available(iOS 11, *) {
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
} else {
tableView.tableHeaderView = searchController?.searchBar
}
Theming
fdlFUISearchController_searchBar {
bar-tint-color: @line;
background-color: @primary1_darkBackground;
background-tint-color: @tintColorDark;
}
-
Search bar of the search controller. When instantiating the
FUISearchController
programmatically, a defaultFUISearchBar
is initialized automatically and can be used directly. The developer should set a reference to an@IBOutlet
, if adding a search bar to their view in Interface Builder.Declaration
Swift
override open var searchBar: FUISearchBar { get }
-
Handler for BarcodeScanner button (‘Bookmark button’) click
Important
Because the presentation of the view controller for barcode scanning is invoked internally when this method is called, this method will be invoked on thedelegate
only after the presentation of the view controller is completed.Declaration
Swift
public func searchBarBookmarkButtonClicked(_ searchBar: UISearchBar)
Parameters
searchBar
calling
UISearchBar
-
Implement this method on your manual bar delegate when not managed by a UIKit controller. UINavigationBar and UISearchBar default to UIBarPositionTop, UIToolbar defaults to UIBarPositionBottom. This message will be sent when the bar moves to a window.
Declaration
Swift
public func position(for bar: UIBarPositioning) -> UIBarPosition