开发者

Highlight the searched text in UITableView using UISearchBar

Using UISearchBar searching text in UITableView. I just want to know how to highlight searched text. Highlighting could be make text bold or change text color.

E.g. If I'm searching text "Stack" using UISearchBar in UITableView which con开发者_如何学运维tains a row with string "Stackoverflow", now my search result should appear this way "Stackoverflow".

Thanks in advance.. Happy coding..


Usually it's enough to filter cells in UITableView conforming your search term. Hope you understand how that could be arranged. If you want highlight search term in a cell, your cell needs to support such highlight, than you could highlight calling something like [mycell highlightText:searchBar.text]. Ready cells don't support such highlight, you need to build your custom cell which will do that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜