Reputation: 15520
How would I add line numbers to Core Text say in a view down the left hand side?
I'm not looking for exact details just how to know where each line starts and ends so I can deduce where to add the numbers in the separate view.
Upvotes: 2
Views: 1314
Reputation: 3478
If you're laying out the text using CTFramesetter
, then you can call CTFrameGetLineOrigins
on your frame. Each origin represents the start of the baseline for that line. Keep in mind that Core Text uses the Quartz coordinate system, where Y increases from bottom to top.
Upvotes: 2