iOS:如何跟踪用戶製作的書籤? (iOS: How to keep track of the bookmarks the user makes?)


問題描述

iOS:如何跟踪用戶製作的書籤? (iOS: How to keep track of the bookmarks the user makes?)

guys. I'm working on my book app and I have trouble keeping track of the bookmarks the user makes. My app works fine if the font is fixed, but I want to allow the user to change the font size. For example, the user makes a bookmark on page 16, but he makes the font size bigger, so the last part of the text on page 16 is pushed to the next page. When he comes back  to the text he wants to read, he won't find it on page 16 because it will be in page 17.

Here is my question: How can I keep track of the bookmarks the user makes? I would appreciate it if someone gave me some tips on this.


參考解法

方法 1:

It would make the bookmark by range. That way, if you want to bookmark by the contents of the entire page, you can save the range of the visible text (detailed here), or you could bookmark by a smaller selection of text. Either way, you'll be storing the bookmark in the form of a NSRange.

Then when it comes time to jump to the bookmark, you can simply use UITextView's scrollRangeToVisible:.

[textView scrollRangeToVisible:<#(NSRange)#>];

(by boochan224Mick MacCallum)

參考文件

  1. iOS: How to keep track of the bookmarks the user makes? (CC BY‑SA 3.0/4.0)

#iphone #iOS






相關問題

iPhone 3.0 MPMoviePlayerController 在屏幕上顯示視頻播放器的等待時間長有問題嗎? (Problem with iPhone 3.0 MPMoviePlayerController long wait time to display the video player on screen?)

將 NavigationBar 背景更改為圖像 (Changing the NavigationBar background to image)

如何將以下行添加到我的 plist 文件中? (How can I add the following lines to my plist file?)

iPhone SDK:檢查 UITableView 中每個對象的 ID 號並相應地更改徽章號 (iPhone SDK: Checking the ID number for each object in a UITableView and change the badge number accordingly)

無法在不崩潰的情況下設置 ABPeoplePickerNavigationController 的 addressBook 屬性 (Can't set the addressBook property of ABPeoplePickerNavigationController without crashing)

嵌套 XML 示例? (Nested XML Example?)

提交應用程序 - 添加本地化,但我的語言未列在組合框中? (Submitting app - Add Localizations, but my language is not listed in the combo box?)

如何從移動瀏覽器直接訪問移動設備的硬件功能 (How to gain direct access to the hardware capabilities of mobile devices from mobile browsers)

Cocos2d 中的粒子碰撞檢測 (Collision detection with particles in Cocos2d)

捕捉返回按鈕導航事件 (Catching back button navigation event)

iphone初學者問題:畫一個矩形。我究竟做錯了什麼? (Beginner iphone question: drawing a rectangle. What am I doing wrong?)

帶有 UITableView 的 UIPopoverController (UIPopoverController with UITableView)







留言討論