views:

36

answers:

1

hi,

I want to read the line number like a word doc in my iphone application. I tried using the webUI controller for displaying the doc but could not find any ways for reading the contents/line number.

Is there any widget using which i can read the contents/page of the page.

TIA

+1  A: 

The problem here is that most text formats do not have a logical line number anymore. Text is logically configured so that it wraps to fit the physical dimensions of the UI display element. The visual line is constantly shifting as the user alters the UI (window size, font size etc.) The UI on the iPhone is more stable but the fundamental problem remains.

The only thing you can really do is count some logical structure in the text such as sentences or paragraphs. If you're dealing with code, you can count logical blocks of each particular language.

The preferred way to do that on the Apple API is to use one or more NSScanner instances to search for specific patterns in the text.

TechZen