Skip to content

Commit

Permalink
Revert "添加搜索关键词高亮效果"
Browse files Browse the repository at this point in the history
This reverts commit 1eb2310.
  • Loading branch information
jaypen7 committed Jul 8, 2022
1 parent 1eb2310 commit f08baf9
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions Unwrap/Activities/Learn/Glossary/GlossaryDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,7 @@ class GlossaryDataSource: NSObject, UITableViewDataSource, UISearchResultsUpdati
let key = sectionTitles[indexPath.section]
if let entries = sortedEntries[key] {
let entry = entries[indexPath.row]

// 添加搜索关键词高亮效果
let attrText = NSMutableAttributedString(string: entry.term)
if let searchText = delegate?.navigationItem.searchController?.searchBar.text, let highlightRange = attrText.string.range(of: searchText, options: .caseInsensitive, range: nil, locale: nil) {
let nsRange = NSRange(highlightRange, in: attrText.string)
attrText.addAttributes([NSAttributedString.Key.foregroundColor: UIColor.systemYellow, NSAttributedString.Key.font: Unwrap.scaledExtraBoldFont], range: nsRange)
}
cell.textLabel?.attributedText = attrText

// cell.textLabel?.text = entry.term
cell.textLabel?.text = entry.term
cell.detailTextLabel?.attributedText = entry.description.fromSimpleHTML()
}

Expand Down

0 comments on commit f08baf9

Please sign in to comment.