Selection of text in core text like ibook

人走茶凉 提交于 2019-12-23 06:05:30

问题


i done a bible application which uses core text for showing verses in a view...the txt came from locally stored sqlite db,,,i am using this core text wrapper for rendering my text,,,becz it support multi column view ,,core text warpper,,,but i need the selection of verse functionality...if the user tap the verse it need to select that particular verse,,if i have this verse 1 The God create Heave and earth . 2 etc etc,,, . 3 etc etc,,,, . when the user tap the first verse it need to select that verse and highlight that verse.....like the eBible app or ibook app...

Is there any example to show this kind of functionality in core text..Plz give me a link which might be helpful . Thabnks in advcance.


回答1:


I do something similar in my Bible app (https://github.com/photokandyStudios/gbible). In particular, see https://github.com/photokandyStudios/gbible/blob/master/gbible/PKBibleViewController.m#L1301

Essentially I maintain a selection array, and when a user taps the verse (in my case a uitableviewcell), I add it to the array. I also color the background of the cell to reflect the selection.

It isn't word-perfect selection with the loupe, but for my purposes, good enough.



来源:https://stackoverflow.com/questions/10468075/selection-of-text-in-core-text-like-ibook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!