I'm trying to set up a text view to show lines of text, along with line numbers on the right margin. The string for the text view would look something like this:
"Text of first line" + "Line 1" + "\n" + "Text of second line" + "Line 2" + "\n"
I want the end result to look something like this:
Into my heart an air that kills, 1
From yon far country blows: 2
What are those blue remembered hills, 3
What spires, what farms are those? 4
(Sorry about the crooked right column: it looked fine in the message editor. The numbers should all be in a straight column, aligned to the right margin of the text view.)
Is it possible to use an NSAttributedString to do this? I've tried several different ways of constructing such a string, but no luck so far. I'm beginning to think this is the wrong approach entirely. What is the best way to get the kind of layout that I want?