NSString and tab stops?

Member
Posts: 241
Joined: 2008.07
Post: #1
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!
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #2
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.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #3
lol thanks
It's always great to know I'm screwed. hahaaha
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
You may (or may not!) be able to abuse WebKit for the purpose...
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #5
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!
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #6
Replacing tabs with spaces isn't a solution unless you're using a monospaced font.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #7
Meh, that's right. Guess I'll have to go with pixels. I'll figure something out.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Texture stops rendering klaars 2 3,769 Jul 29, 2011 08:46 AM
Last Post: klaars
  NSMutableDictionary with key:(NSString*) efficiency bmantzey 4 5,467 Nov 9, 2008 08:11 AM
Last Post: AnotherJake