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.