NSString and tab stops?
One more question I have. I am putting 3 columns of data into one UITextView. I want to align the data at a certain point, regardless of the length of the previous characters. I know there are vast options for NSString formatting. Is there anything I could do to put something like a \t into the string so that NSString recognizes that character and moves the string of text to a certain position in the string?
I could probably hack something together but I wanted to check it out first to see if something is already written that does this. Thanks!
I could probably hack something together but I wanted to check it out first to see if something is already written that does this. Thanks!
NSString definitely knows nothing about tab stops. That's all in NSParagraphStyle on the Mac, and no public equivalent exists on the phone, so I'm pretty sure you're screwed. You can make your own view that uses tabs to draw at certain positions, though.
lol thanks
It's always great to know I'm screwed. hahaaha
It's always great to know I'm screwed. hahaaha
You may (or may not!) be able to abuse WebKit for the purpose...
I may just extend NSString. I've never actually done that before, so it'll be interesting. I'm thinking about it. I could start by determining the number of spaces to the tab location that I need and when the /t is encountered in the string, just insert that many spaces (minus the number of letters to that point) or something. I'll figure something out. I was just hoping maybe there was some convenience feature in NSString. Thanks once again for all your help!
Replacing tabs with spaces isn't a solution unless you're using a monospaced font.
Meh, that's right. Guess I'll have to go with pixels. I'll figure something out.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Texture stops rendering | klaars | 2 | 3,202 |
Jul 29, 2011 08:46 AM Last Post: klaars |
|
| NSMutableDictionary with key:(NSString*) efficiency | bmantzey | 4 | 4,952 |
Nov 9, 2008 08:11 AM Last Post: AnotherJake |
|

