File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ open class SearchTextField: UITextField {
8080 /// Set your custom set of attributes in order to highlight the string found in each item
8181 open var highlightAttributes : [ NSAttributedStringKey : AnyObject ] = [ . font: UIFont . boldSystemFont ( ofSize: 10 ) ]
8282
83+ /// Disable highlight attributes
84+ open var forceNoHighlightAttributes = false
85+
8386 /// Start showing the default loading indicator, useful for searches that take some time.
8487 open func showLoadingIndicator( ) {
8588 self . rightViewMode = . always
@@ -439,10 +442,12 @@ open class SearchTextField: UITextField {
439442 item. attributedTitle = NSMutableAttributedString ( string: item. title)
440443 item. attributedSubtitle = NSMutableAttributedString ( string: ( item. subtitle != nil ? item. subtitle! : " " ) )
441444
442- item. attributedTitle!. setAttributes ( highlightAttributes, range: titleFilterRange)
443-
444- if subtitleFilterRange. location != NSNotFound {
445- item. attributedSubtitle!. setAttributes ( highlightAttributesForSubtitle ( ) , range: subtitleFilterRange)
445+ if !forceNoHighlightAttributes {
446+ item. attributedTitle!. setAttributes ( highlightAttributes, range: titleFilterRange)
447+
448+ if subtitleFilterRange. location != NSNotFound {
449+ item. attributedSubtitle!. setAttributes ( highlightAttributesForSubtitle ( ) , range: subtitleFilterRange)
450+ }
446451 }
447452
448453 filteredResults. append ( item)
You can’t perform that action at this time.
0 commit comments