Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight the search text after searching in a UITableView

Tags:

xcode

ios

iphone

Hi can anyone help me how text can be highlighted after search, i want to search data from sqlite database and display it in a UITableView, so how i can highlight the search keyword only in the search Result? Please help?

like image 627
Shaheen Rehman Avatar asked Nov 13 '22 03:11

Shaheen Rehman


1 Answers

Here's how I would do it: Create a custom cell, and a view in that cell, to include the text. You will need to use core text to be able to change the parts of background/text color from your string. Upon your search, change the color/background color of text in drawRect method.

Please see this for more about Core Text.

like image 73
Basel Avatar answered Nov 16 '22 03:11

Basel