English 中文(简体)
如何在 UITableView 中显示搜索词句的搜索结果
原标题:How to display the search results of a search term with its sentence in UITableView

我在核心数据中拥有一个数额的 " HUGE " 文本,并在我的表格View中使用了搜索栏(其中显示文本),并在有 " 财务主管和国家预报 " 的各实体中进行了搜索。

因此,UITableView 显示包含搜索词的“强度”文本结果 search united OR 2-3 字句的句子。

例如,如果我有一个类似“我对飞行型号飞机有广泛了解,并热爱核心数据”和搜索“飞行”,我只想显示“......对“强飞”型号飞机有广泛的了解..................关于“强飞”型号飞机的知识......”。

我该怎么做?

问题回答

你要用粗体显示吗?

如果回答否,答案如下:

  • first get the range of the text that has been searched, for example let say you were searching for "word" in sentence "this is the word am searching" search for the range of "word" that is 12, and save it in a variable then get the a substring with the range from 12 - 10 (range [2,10]) and save it in another variable lastly get a sbustring of 10 characters after the word for range [12+4,10] and save it into another variable

现在将所有这些变量(在+ " " " " " + " 字 " + " + " + " 后)合并并显示

如果您需要用黑体字来表示, 那么您就可以使用一些图书馆, 如“ OHATFlativeLabel ”, 读更多 < a href=> https://github.com/ AliSoftware/ OHATFliveLabel / rel = “ nofollow” > https://gitub. com/ AliSoftware/ OHATFiveLabel





相关问题
Search field with Thickbox issue

i have a search form which is shown with Thickbox inside an iframe. the problem is.. that after i click "search" the result page is shown inside the same iframe! and i want it to be shown in the main ...

Will an incomplete google sitemap hurt my search ranking?

If I submit a sitemap.xml which does not contain all of the pages of my site, will this affect my search ranking? For example: If my sitemap only contained pages that had been created in the last ...

speeding up windows file search with C#

i made a program that search logical drives to find a specific file .if user type file name an click search button , searching begins , but i don t know how to stop searching in the middle of process....

JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

Embed Google/ Yahoo search into a web site or build your own

I am looking for an opinion on the whether to use Google custom search, Yahoo search builder or build my own for web projects (no more than 100 pages of content). If I should build my own - do you ...

热门标签